Beginning Filters Python: Difference between revisions

From KitwarePublic
Jump to navigationJump to search
(New page: =Introduction= ParaView filters This usecase shows a user how to use filters to modify the display of data. All filter examples assume that the user starts with a new model. To start o...)
 
No edit summary
Line 16: Line 16:
>>> Show(reader)
>>> Show(reader)
>>> Render()
>>> Render()
[[Image:ClipFilterPython1.png|800px]]
>>> clipFilter = Clip(reader)
>>> clipFilter = Clip(reader)
>>> Hide(reader)
>>> Hide(reader)
>>> Show(clipFilter)
>>> Show(clipFilter)
>>> Render()
>>> Render()
[[Image:ClipFilterPython2.png|800px]]
#get camera
#get camera
>>> camera = GetActiveCamera()
>>> camera = GetActiveCamera()
Line 30: Line 32:
>>> camera.SetPosition(4.15603, 30, -35)
>>> camera.SetPosition(4.15603, 30, -35)
>>> Render()
>>> Render()
[[Image:ClipFilterPython3.png|800px]]
#we can see what's going on a little better
#we can see what's going on a little better
>>> clipFilter.UseValueAsOffset = 1
>>> clipFilter.UseValueAsOffset = 1
>>> clipFilter.Value = 5
>>> clipFilter.Value = 5
>>> Render()
>>> Render()
[[Image:ClipFilterPython4.png|800px]]
#let's change the orientation of the clip filter
#let's change the orientation of the clip filter
>>> clipFilter.ClipType.Normal
>>> clipFilter.ClipType.Normal
Line 39: Line 43:
>>> clipFilter.ClipType.Origin
>>> clipFilter.ClipType.Origin
[0.0, 0.0, 0.0]
[0.0, 0.0, 0.0]
>>> clipFilter.Value = 5
#reset the offset value of the clip to 0
>>> Render()
>>> clipFilter.Value = 0
>>> clipFilter.Value = 0
>>> clipFilter.ClipType.Normal = [0,0,1]
>>> clipFilter.ClipType.Normal = [0,0,1]
>>> Render()
>>> Render()
[[Image:ClipFilterPython5.png|800px]]
>>> clipFilter.Value = -3
>>> clipFilter.Value = -3
>>> Render()
>>> Render()
[[Image:ClipFilterPython6.png|800px]]
>>> clipFilter.InsideOut = 1
>>> clipFilter.InsideOut = 1
>>> Render()
>>> Render()
[[Image:ClipFilterPython7.png|800px]]


</source>
</source>




[[Image:clipFilterPython.png|800px]]
   
   
   
   

Revision as of 16:46, 5 August 2009

Introduction

ParaView filters

This usecase shows a user how to use filters to modify the display of data.

All filter examples assume that the user starts with a new model. To start over, go to the menu item Edit → Delete All, and then re-open your data.

Data is opened by going to File → Open. Example data files can be found on the ParaView web page at http://www.paraview.org.


Clip filter

<source lang="python"> >>> from paraview.simple import * >>> reader = ExodusIIReader(FileName=".../can.ex2") >>> Show(reader) >>> Render() ClipFilterPython1.png >>> clipFilter = Clip(reader) >>> Hide(reader) >>> Show(clipFilter) >>> Render() ClipFilterPython2.png

  1. get camera

>>> camera = GetActiveCamera() >>> camera.GetPosition()

  1. figure out where you are

>>> camera.SetPosition(4.156,4.0,-36.29) >>> camera.Elevation(30) >>> camera.GetPosition() (4.1560389876787056, 19.261366923548998, -32.200729057625857) >>> camera.SetPosition(4.15603, 30, -35) >>> Render() ClipFilterPython3.png

  1. we can see what's going on a little better

>>> clipFilter.UseValueAsOffset = 1 >>> clipFilter.Value = 5 >>> Render() ClipFilterPython4.png

  1. let's change the orientation of the clip filter

>>> clipFilter.ClipType.Normal [1.0, 0.0, 0.0] >>> clipFilter.ClipType.Origin [0.0, 0.0, 0.0]

  1. reset the offset value of the clip to 0

>>> clipFilter.Value = 0 >>> clipFilter.ClipType.Normal = [0,0,1] >>> Render() ClipFilterPython5.png >>> clipFilter.Value = -3 >>> Render() ClipFilterPython6.png >>> clipFilter.InsideOut = 1 >>> Render() ClipFilterPython7.png

</source>



Slice filter

File:SliceFilterPython.png


Glyph filter

File:GlyphFilterPython.png


Threshold filter

File:ThresholdFilterPython.png


Contour filter

File:ContourFilterPython.png


Clip to Scalar filter

File:ClipScalarFilterPython.png


Cell to Point/ Point to Cell filters

These filters are used to convert a data set from being cell data to being point data and vice versa. This is sometimes useful if a filter requires one type of data, and a user only has the other type of data. An example would be using can.exo. You cannot get a contour of EQPS directly, since EQPS is cell data and contour only works on points. Use filter Cell Data to Point Data first, then call contour.


Stream Tracer

File:StreamTracerPython.png


Calculator filter

File:CalcFilterPython.png


Acknowledgements

Sandia is a multiprogram laboratory operated by Sandia Corporation, a Lockheed Martin Company, for the United States Department of Energy’s National Nuclear Security Administration under contract DE-AC04-94AL85000.