Wall Projection

Revision as of 17:08, 30 June 2017 by BradWhitlock (talk | contribs) (Data Binning)

VisIt does not currently provide a way to automatically project different views of a plot onto axis aligned wall planes. However, this feature can be achieved using other functionality in VisIt. For example, we could use Python scripting to save images from different views and then draw those images as the walls, scaling and rotating the images as needed. Another way would be to use the DataBinning operator to sum the values along the X, Y, Z dimensions respectively and then transform those plots to appear as walls.

Data Binning

The following script shows how to use DataBinning with multiple plots to create walls that represent the data summed along the X, Y, Z dimensions.

db = "noise.silo"
OpenDatabase(db)

# Create plot 1
AddPlot("Pseudocolor", "hardyglobal", 0, 0)
atts = PseudocolorAttributes()
atts.legendFlag = 0
SetPlotOptions(atts)
AddOperator("Isovolume", 0)
opAtts = IsovolumeAttributes()
opAtts.variable = "hardyglobal"
opAtts.lbound = 4
SetOperatorOptions(opAtts)

# Create plot 2
AddPlot("Pseudocolor", "operators/DataBinning/2D/Mesh", 0, 0)
atts = PseudocolorAttributes()
atts.minFlag = 1
atts.maxFlag = 1
atts.max = 220
atts.colorTableName = "plasma"
atts.legendFlag = 0
SetPlotOptions(atts)
AddOperator("Isovolume", 0)
opAtts = IsovolumeAttributes()
opAtts.variable = "hardyglobal"
opAtts.lbound = 4
SetOperatorOptions(opAtts)
AddOperator("DataBinning", 0)
opAtts = DataBinningAttributes()
opAtts.numDimensions = opAtts.Two  # One, Two, Three
opAtts.dim1BinBasedOn = opAtts.X  # X, Y, Z, Variable
opAtts.dim2BinBasedOn = opAtts.Y  # X, Y, Z, Variable
opAtts.reductionOperator = opAtts.Sum  # Average, Minimum, Maximum, StandardDeviation, Variance, Sum, Count, RMS, PDF
opAtts.varForReduction = "hardyglobal"
SetOperatorOptions(opAtts)
AddOperator("Elevate", 0)
opAtts = ElevateAttributes()
opAtts.zeroFlag = 1
SetOperatorOptions(opAtts)
AddOperator("Transform", 0)
opAtts = TransformAttributes()
opAtts.doTranslate = 1
opAtts.translateZ = -10
SetOperatorOptions(opAtts)
RemoveOperator(0)

# Create plot 3
AddPlot("Pseudocolor", "operators/DataBinning/2D/Mesh", 0, 0)
atts = PseudocolorAttributes()
atts.minFlag = 1
atts.maxFlag = 1
atts.max = 220
atts.colorTableName = "plasma"
atts.legendFlag = 0
SetPlotOptions(atts)
AddOperator("Isovolume", 0)
opAtts = IsovolumeAttributes()
opAtts.variable = "hardyglobal"
opAtts.lbound = 4
SetOperatorOptions(opAtts)
AddOperator("DataBinning", 0)
opAtts = DataBinningAttributes()
opAtts.numDimensions = opAtts.Two  # One, Two, Three
opAtts.dim1BinBasedOn = opAtts.Z  # X, Y, Z, Variable
opAtts.dim2BinBasedOn = opAtts.Y  # X, Y, Z, Variable
opAtts.reductionOperator = opAtts.Sum  # Average, Minimum, Maximum, StandardDeviation, Variance, Sum, Count, RMS, PDF
opAtts.varForReduction = "hardyglobal"
SetOperatorOptions(opAtts)
AddOperator("Elevate", 0)
opAtts = ElevateAttributes()
opAtts.zeroFlag = 1
SetOperatorOptions(opAtts)
AddOperator("Transform", 0)
opAtts = TransformAttributes()
opAtts.doRotate = 1
opAtts.rotateAxis = (0, 1, 0)
opAtts.rotateAmount = -90
opAtts.doTranslate = 1
opAtts.translateX = -10
SetOperatorOptions(opAtts)
RemoveOperator(0)

# Create plot 4
AddPlot("Pseudocolor", "operators/DataBinning/2D/Mesh", 0, 0)
atts = PseudocolorAttributes()
atts.minFlag = 1
atts.maxFlag = 1
atts.max = 220
atts.legendFlag = 0
atts.colorTableName = "plasma"
SetPlotOptions(atts)
AddOperator("Isovolume", 0)
opAtts = IsovolumeAttributes()
opAtts.variable = "hardyglobal"
opAtts.lbound = 4
SetOperatorOptions(opAtts)
AddOperator("DataBinning", 0)
opAtts = DataBinningAttributes()
opAtts.numDimensions = opAtts.Two  # One, Two, Three
opAtts.dim1BinBasedOn = opAtts.X  # X, Y, Z, Variable
opAtts.dim2BinBasedOn = opAtts.Z  # X, Y, Z, Variable
opAtts.reductionOperator = opAtts.Sum  # Average, Minimum, Maximum, StandardDeviation, Variance, Sum, Count, RMS, PDF
opAtts.varForReduction = "hardyglobal"
SetOperatorOptions(opAtts)
AddOperator("Elevate", 0)
opAtts = ElevateAttributes()
opAtts.zeroFlag = 1
SetOperatorOptions(opAtts)
AddOperator("Transform", 0)
opAtts = TransformAttributes()
opAtts.doRotate = 1
opAtts.rotateAxis = (1, 0, 0)
opAtts.rotateAmount = 90
opAtts.doTranslate = 1
opAtts.translateY = -10
SetOperatorOptions(opAtts)
RemoveOperator(0)

SetActivePlots(0)

DrawPlots()

# Set the view
view = View3DAttributes()
view.viewNormal = (0.624217, 0.357593, 0.694607)
view.focus = (-1.77636e-14, -1.77636e-14, 0)
view.viewUp = (-0.241909, 0.93387, -0.263375)
view.viewAngle = 30
view.parallelScale = 17.3205
view.nearPlane = -34.641
view.farPlane = 34.641
view.imagePan = (-0.00488783, 0.0463113)
view.imageZoom = 1.08742
view.perspective = 1
view.eyeAngle = 2
view.centerOfRotationSet = 0
view.centerOfRotation = (-1.77636e-14, -1.77636e-14, 0)
view.axis3DScaleFlag = 0
view.axis3DScales = (1, 1, 1)
view.shear = (0, 0, 1)
view.windowValid = 1
SetView3D(view)

# Set the annotation attributes
annot = AnnotationAttributes()
annot.axes3D.visible = 0
annot.axes3D.triadFlag = 1
annot.axes3D.bboxFlag = 0
annot.userInfoFlag = 0
annot.databaseInfoFlag = 0
annot.timeInfoFlag = 1
annot.legendInfoFlag = 1
annot.backgroundColor = (255, 255, 255, 255)
annot.foregroundColor = (255, 255, 255, 255)
annot.gradientBackgroundStyle = annot.TopToBottom  # TopToBottom, BottomToTop, LeftToRight, RightToLeft, Radial
annot.gradientColor1 = (153, 204, 255, 255)
annot.gradientColor2 = (127, 130, 212, 255)
annot.backgroundMode = annot.Gradient  # Solid, Gradient, Image, ImageSphere
SetAnnotationAttributes(annot)

light = GetLight(0)
light.enabledFlag = 1
light.type = light.Camera  # Ambient, Object, Camera
light.direction = (-0.125, -0.338, -0.933)
light.color = (255, 255, 255, 255)
light.brightness = 1
SetLight(0, light)

R = GetRenderingAttributes()
R.scalableActivationMode = R.Always  # Never, Always, Auto
R.specularFlag = 1
R.specularCoeff = 0.6
R.specularPower = 10
R.specularColor = (255, 255, 255, 255)
R.doShadowing = 1
R.shadowStrength = 0.25
SetRenderingAttributes(R)

Running this command will plot the noise.silo data in the VisIt CLI:

visit -cli -s wallproject.py

Wallproject.png