Skip to content
Snippets Groups Projects
Commit 6c9c2e5e authored by Bill Lorensen's avatar Bill Lorensen
Browse files

ENH: More python images

parent c4111a9c
No related branches found
No related tags found
No related merge requests found
......@@ -150,7 +150,7 @@ This section includes examples of manipulating meshes.
|--------------|----------------------|-------------|
[BackgroundImage](/Python/BackgroundImage) | [vtkJPEGReader](http://www.vtk.org/doc/nightly/html/classvtkJPEGReader.html), [vtkImageCanvasSource2D](http://www.vtk.org/doc/nightly/html/classvtkImageCanvasSource2D.html), [vtkImageActor](http://www.vtk.org/doc/nightly/html/classvtkImageActor.html), [vtkSuperquadricSource](http://www.vtk.org/doc/nightly/html/classvtkSuperquadricSource.html) |
[Cutter](/Python/Cutter) | [vtkCutter](http://www.vtk.org/doc/nightly/html/classvtkCutter.html) |
[ImplicitDataSet](/Python/ImplicitDataSet) | [vtkImplicitDataSet](http://www.vtk.org/doc/nightly/html/classvtkImplicitDataSet.html)]( vtkIdType | n/a | This is just a typedef, Python, you can use a python "int" or "long" for vtkIdType.
[ImplicitDataSet](/Python/ImplicitDataSet) | [vtkImplicitDataSet](http://www.vtk.org/doc/nightly/html/classvtkImplicitDataSet.html) | vtkIdType n/a. This is just a typedef, Python, you can use a python "int" or "long" for vtkIdType.
[Screenshot](/Python/Screenshot) | [vtkWindowToImageFilter](http://www.vtk.org/doc/nightly/html/classvtkWindowToImageFilter.html) |
[Variant](/Python/Variant) | [vtkVariant](http://www.vtk.org/doc/nightly/html/classvtkVariant.html) |
[vtkVersion](/Python/vtkVersion) | [vtkVersion](http://www.vtk.org/doc/nightly/html/classvtkVersion.html) |
......
......@@ -16,7 +16,7 @@ source.SetRadius(5.0)
# mapper
mapper = vtk.vtkPolyDataMapper()
mapper.SetInput(source.GetOutput())
mapper.SetInputConnection(source.GetOutputPort())
# actor
actor = vtk.vtkActor()
......
......@@ -33,7 +33,7 @@ clipper.Update()
# Vis for clipped sphere
mapper = vtk.vtkPolyDataMapper()
mapper.SetInputConnection(clipper.GetOutputPort())
actor = vtk.vtkActor()
actor = vtk.vtkActor()`<
actor.SetMapper(mapper)
# Vis for cube so can see it in relation to clipped sphere
......
......@@ -16,7 +16,7 @@ source.SetRadius(5.0)
# mapper
mapper = vtk.vtkPolyDataMapper()
mapper.SetInput(source.GetOutput())
mapper.SetInputConnection(source.GetOutputPort())
# actor
actor = vtk.vtkActor()
......@@ -37,7 +37,7 @@ w2if.Update()
writer = vtk.vtkPNGWriter()
writer.SetFileName("screenshot.png")
writer.SetInput(w2if.GetOutput())
writer.SetInputConnection(w2if.GetOutputPort())
writer.Write()
# enable user interface interactor
......
### Description
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.
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
......
......@@ -11,7 +11,7 @@ glyphed and colored by elevation using the default lookup table.
The example also demonstrates partitioning the pipelines into functions and how
to generate a custom lookup table to handle irregular distributions of data.
For generating surfaces, the trick here is to return vtkPolydata for surfaces
For generating surfaces, the trick here is to return [vtkPolydata](http://www.vtk.org/doc/nightly/html/classvtkPolydata.html) for surfaces
thereby hiding the particular surface properties in the implementation of the
function. This allows us to specify multiple surface types and, in this code,
to use an enum to pick the one we want.
......@@ -23,7 +23,7 @@ The process is as follows:
1. Use an enum to select your surface generating elevations and curvatures and clipping is needed.
2. Use vtkColorSeries to make an indexed lookup table.
2. Use [vtkColorSeries](http://www.vtk.org/doc/nightly/html/classvtkColorSeries.html) to make an indexed lookup table.
3. Then we use the number of colors in the lookup table and the scalar range of the surface to create a list/vector of bands. If need be we generate manual bands.
......@@ -37,16 +37,16 @@ The process is as follows:
8. Then everything is put together for the rendering in the usual actor/mapper pipeline. The reversed lookup table is used by the scalar bar actor so that the maximum value is at the top if the actor is placed in its default orientation/position.
9. The function Display() pulls together all the components and returns a vtkRenderWindowInteractor so that you can interact with the image.
9. The function Display() pulls together all the components and returns a [vtkRenderWindowInteractor](http://www.vtk.org/doc/nightly/html/classvtkRenderWindowInteractor.html) so that you can interact with the image.
Feel free to experiment with different color schemes and/or the other
sources from the parametric function group or the torus etc.
or versions of VTK older than VTK 8.0:
In the function `MakeParametricHills()` you may have to set `ClockwiseOrderingOff()` when using vtkParametricRandomHills as a source,
In the function `MakeParametricHills()` you may have to set `ClockwiseOrderingOff()` when using [vtkParametricRandomHills](http://www.vtk.org/doc/nightly/html/classvtkParametricRandomHills.html) as a source,
this ensures that the normals face in the expected direction, the default is `ClockwiseOrderingOn()`.
As an alternative, in `MakeGlyphs()`, you can set reverseNormals to True thereby invoking vtkReverseSense to achieve the same effect.
As an alternative, in `MakeGlyphs()`, you can set reverseNormals to True thereby invoking [vtkReverseSense](http://www.vtk.org/doc/nightly/html/classvtkReverseSense.html) to achieve the same effect.
You will usually need to adjust the parameters for maskPts,
arrow and glyph for a nice appearance.
......
......@@ -11,7 +11,7 @@ glyphed and colored by elevation using the default lookup table.
The example also demonstrates partitioning the pipelines into functions.
For generating surfaces, the trick here is to return vtkPolydata for surfaces
For generating surfaces, the trick here is to return [vtkPolydata](http://www.vtk.org/doc/nightly/html/classvtkPolydata.html) for surfaces
thereby hiding the particular surface properties in the implementation of the
function. This allows us to specify multiple surface types and, in this code,
to use the name of the surface to pick the one we want.
......@@ -20,7 +20,7 @@ The process is as follows:
1. Use an enum to select your surface.
2. Use vtkColorSeries to make an indexed lookup table.
2. Use [vtkColorSeries](http://www.vtk.org/doc/nightly/html/classvtkColorSeries.html) to make an indexed lookup table.
3. Then we use the number of colors in the lookup table and the scalar range of the surface to create a list/vector of bands.
......@@ -34,15 +34,15 @@ The process is as follows:
8. Then everything is put together for the rendering in the usual actor/mapper pipeline. The reversed lookup table is used by the scalar bar actor so that the maximum value is at the top if the actor is placed in its default orientation/position.
9. The function Display() pulls together all the components and returns a vtkRenderWindowInteractor so that you can interact with the image.
9. The function Display() pulls together all the components and returns a [vtkRenderWindowInteractor](http://www.vtk.org/doc/nightly/html/classvtkRenderWindowInteractor.html) so that you can interact with the image.
Feel free to experiment with different color schemes and/or the other
sources from the parametric function group or a cone etc.
For versions of VTK older than VTK 8.0:
In the function `MakeParametricHills()` you may have to set `ClockwiseOrderingOff()` when using vtkParametricRandomHills as a source, this ensures that the normals face in the expected direction, the default is `ClockwiseOrderingOn()`.
As an alternative, in `MakeGlyphs()`, you can set reverseNormals to True thereby invoking vtkReverseSense to achieve the same effect.
In the function `MakeParametricHills()` you may have to set `ClockwiseOrderingOff()` when using [vtkParametricRandomHills](http://www.vtk.org/doc/nightly/html/classvtkParametricRandomHills.html) as a source, this ensures that the normals face in the expected direction, the default is `ClockwiseOrderingOn()`.
As an alternative, in `MakeGlyphs()`, you can set reverseNormals to True thereby invoking [vtkReverseSense](http://www.vtk.org/doc/nightly/html/classvtkReverseSense.html) to achieve the same effect.
You will usually need to adjust the parameters for maskPts,
arrow and glyph for a nice appearance.
......
......@@ -39,9 +39,9 @@ glyph.SetInputConnection(elev.GetOutputPort())
# Here is where we build the glyph table
# that will be indexed into according to the IndexMode
glyph.SetSource(0,cs.GetOutput())
glyph.SetSource(1,ss.GetOutput())
glyph.SetSource(2,cs2.GetOutput())
glyph.SetSourceConnection(0,cs.GetOutputPort())
glyph.SetSourceConnection(1,ss.GetOutputPort())
glyph.SetSourceConnection(2,cs2.GetOutputPort())
glyph.ScalingOn()
glyph.SetScaleModeToScaleByScalar()
......
### Description
This example demonstrates the usage of the vtkNamedColors class. Some helper functions are also implemented.
This example demonstrates the usage of the [vtkNamedColors](http://www.vtk.org/doc/nightly/html/classvtkNamedColors.html) class. Some helper functions are also implemented.
A cone is created and contoured using the BandedPolyDataContourFilter, it is then colored using a lookup table where the colors have been assigned using color names.
A list of available color names and any synonyms are also output.
......@@ -139,7 +139,7 @@ def CheckVTKVersion(requiredMajorVersion):
:param: requiredMajorVersion e.g. 6
'''
version = vtk.vtkVersion()
if version.GetVTKMajorVersion() > requiredMajorVersion:
if version.GetVTKMajorVersion() < requiredMajorVersion:
raise
else:
return
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment