def createData(): global gBBox, gDataSet, adata import numpy from math import sqrt, pow from pyvisus.numpyconversion import VisusIncoreEncoder idim = 50 jdim = 50 kdim = 50 data = [] for i in xrange(idim * jdim * kdim): data.append(0) for i in xrange(idim): for j in xrange(jdim): for k in xrange(kdim): data[k + j * kdim + i * jdim * kdim] = sqrt( pow(i - 25.0, 2) + pow(j - 25.0, 2) + pow(k - 25.0, 2)) adata = numpy.array(data) encoder = VisusIncoreEncoder(idim, jdim, kdim, 1) encoder.domain([0, 0, 0], [1.0 * idim, 1.0 * jdim, 0.1 * kdim]) encoder.field(adata) gDataSet = str(encoder) # Make the data source print "Opening dataset(%s)" % gDataSet data = VisusDataSourceFactory.make(gDataSet) if not data.isValid(): raise RuntimeError("Loaded data is not valid") gSamples = data.samples() left = VectorDouble(3) right = VectorDouble(3) data.domainBoundingBox(left, right) gBBox = VisusBoundingBox() gBBox.set(left, right) return
def createData(): global gBBox, gDataSet, adata import numpy from math import sqrt, pow from pyvisus.numpyconversion import VisusIncoreEncoder idim = 50 jdim = 50 kdim = 50 data = [] for i in xrange(idim*jdim*kdim): data.append(0) for i in xrange(idim): for j in xrange(jdim): for k in xrange(kdim): data[k+j*kdim+i*jdim*kdim] = sqrt(pow(i-25.0,2) + pow(j-25.0,2) + pow(k-25.0,2)) adata = numpy.array(data) encoder = VisusIncoreEncoder(idim,jdim,kdim,1) encoder.domain([0,0,0],[1.0*idim,1.0*jdim,0.1*kdim]) encoder.field(adata) gDataSet = str(encoder) # Make the data source print "Opening dataset(%s)" % gDataSet data = VisusDataSourceFactory.make(gDataSet); if not data.isValid(): raise RuntimeError("Loaded data is not valid") gSamples = data.samples(); left = VectorDouble(3) right= VectorDouble(3) data.domainBoundingBox(left,right); gBBox = VisusBoundingBox() gBBox.set(left,right); return
def createData(filename=None): global gBBox, gDataSet, adata if filename is None: import numpy from math import sqrt, pow from pyvisus.numpyconversion import VisusIncoreEncoder data = [] for i in xrange(50 * 50 * 50): data.append(0) for i in xrange(50): for j in xrange(50): for k in xrange(50): data[k + j * 50 + i * 50 * 50] = sqrt( pow(i - 25.0, 2) + pow(j - 25.0, 2) + pow(k - 25.0, 2)) adata = numpy.array(data) encoder = VisusIncoreEncoder(50, 50, 50) encoder.field(adata) gDataSet = str(encoder) else: gDataSet = "Idx:%s" % filename # Make the data source print "Opening dataset(%s)" % gDataSet data = VisusDataSourceFactory.make(gDataSet) if not data.isValid(): raise RuntimeError("Loaded data is not valid") gSamples = data.samples() left = VectorDouble(3) right = VectorDouble(3) data.domainBoundingBox(left, right) gBBox = VisusBoundingBox() gBBox.set(left, right) return
def createData(filename=None): global gBBox, gDataSet, adata if filename is None: import numpy from math import sqrt, pow from pyvisus.numpyconversion import VisusIncoreEncoder data = [] for i in xrange(50*50*50): data.append(0) for i in xrange(50): for j in xrange(50): for k in xrange(50): data[k+j*50+i*50*50] = sqrt(pow(i-25.0,2) + pow(j-25.0,2) + pow(k-25.0,2)) adata = numpy.array(data) encoder = VisusIncoreEncoder(50,50,50) encoder.field(adata) gDataSet = str(encoder) else: gDataSet = "Idx:%s" % filename # Make the data source print "Opening dataset(%s)" % gDataSet data = VisusDataSourceFactory.make(gDataSet); if not data.isValid(): raise RuntimeError("Loaded data is not valid") gSamples = data.samples(); left = VectorDouble(3) right= VectorDouble(3) data.domainBoundingBox(left,right); gBBox = VisusBoundingBox() gBBox.set(left,right); return
glutDisplayFunc(display) glutReshapeFunc(reshape) glutMouseFunc(mouse) glutKeyboardFunc(keyboard) glutMotionFunc(motion) glutIdleFunc(idle) data = createData(func1, 0) gSamples = data.samples() left = VectorDouble(3) right = VectorDouble(3) data.domainBoundingBox(left, right) gBBox = VisusBoundingBox() gBBox.set(left, right) createData(func2, 1) box = constructWorldBox(gBBox) # Create the default scene graph #gRoot = VisusSceneNode.construct() gRoot = VisusGroup.construct() if not gRoot.setValue(gBBox): print "Error occurred setting bbox" gRoot.mapToWorldBox(box) gRoot.drawBoundingBox(True) gFocus = gRoot colorMap = banded()
glutKeyboardFunc( keyboard ) glutMotionFunc( motion ) glutIdleFunc( idle ) glInit() data = createData(funcIso, ISO_NDX) createData(funcColor, COLOR_NDX) gSamples = data.samples(); left = VectorDouble(3) right= VectorDouble(3) data.domainBoundingBox(left,right); gBBox = VisusBoundingBox() gBBox.set(left,right); box = constructWorldBox(gBBox) # Create the default scene graph gRoot = VisusGroup.construct() if not gRoot.setValue(gBBox): print "Error occurred setting bbox" gRoot.mapToWorldBox(box) gRoot.drawBoundingBox(True) gFocus = gRoot isoValue = VisusIsoValue(7.0) iso = addIsoSurface(gRoot) iso.setValue(isoValue)
glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGBA | GLUT_DEPTH | GLUT_MULTISAMPLE) glutInitWindowSize(winWidth, winHeight) glutInitWindowPosition(200, 200) window = glutCreateWindow("ViSUS Earth Test") glutDisplayFunc(display) glutReshapeFunc(reshape) glutMouseFunc(mouse) glutKeyboardFunc(keyboard) glutMotionFunc(motion) glutIdleFunc(idle) # Create the default scene graph gBBox = VisusBoundingBox() gBBox.set(-5, -5, -5, 5, 5, 5) gRoot = VisusSceneNode.construct() gRoot.setValue(gBBox) gFocus = gRoot # Create Earth Radius radius = VisusEarthRadius() radius.set(3.0) # Create Earth earth = VisusEarthNode.construct() earth.setValue(radius) gRoot.attachSubTree(earth) gFocus = earth # Load Texture If Given
glutInitWindowSize(winWidth, winHeight) glutInitWindowPosition(200, 200) gWindow = glutCreateWindow("ViSUS Tick Marks Test") glutDisplayFunc( display ) glutReshapeFunc( reshape ) glutMouseFunc( mouse ) glutKeyboardFunc( keyboard ) glutMotionFunc( motion ) glutIdleFunc( idle ) #initDisplay() # Create the default scene graph bbox = VisusBoundingBox() bbox.set(-5,-5,-5,5,5,5) #gRoot = VisusGroup.construct() gRoot = VisusSceneNode.construct() gRoot.setValue(bbox) gRoot.drawBoundingBox(True) gFocus = gRoot # Create Font font = VisusFont() font.fontSize(5); # Create Tick Marks xTickMarks = VisusTickMarks.construct() axis = xTickMarks.axis() axis.legendText(" Test this X-Axis") axis.labelFont(font)
# # # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL LAWRENCE # LIVERMORE NATIONAL SECURITY, LLC, THE U.S. DEPARTMENT OF ENERGY OR # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR # PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF # LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING # NEGLIGENCE OR OTHERWISE) ARISING # ######################################################################## #~~~ TEST for a simple fltk window ~~~~# from pyvisus.core import VisusBoundingBox, VisusGroup from pyvisus.gui import * root = VisusGroup.construct() box = VisusBoundingBox() box.set(-8,-8,-8,8,8,8) root.setValue(box) root.drawBoundingBox(True) createWindow(root)
glutKeyboardFunc(keyboard) glutMotionFunc(motion) glutIdleFunc(idle) glInit() data = createData(funcIso, ISO_NDX) createData(funcColor, COLOR_NDX) gSamples = data.samples() left = VectorDouble(3) right = VectorDouble(3) data.domainBoundingBox(left, right) gBBox = VisusBoundingBox() gBBox.set(left, right) box = constructWorldBox(gBBox) # Create the default scene graph gRoot = VisusGroup.construct() if not gRoot.setValue(gBBox): print "Error occurred setting bbox" gRoot.mapToWorldBox(box) gRoot.drawBoundingBox(True) gFocus = gRoot isoValue = VisusIsoValue(7.0) iso = addIsoSurface(gRoot) iso.setValue(isoValue)
glutDisplayFunc( display ) glutReshapeFunc( reshape ) glutMouseFunc( mouse ) glutKeyboardFunc( keyboard ) glutMotionFunc( motion ) glutIdleFunc( idle ) data = createData(func1,0) gSamples = data.samples(); left = VectorDouble(3) right= VectorDouble(3) data.domainBoundingBox(left,right); gBBox = VisusBoundingBox() gBBox.set(left,right); createData(func2,1) box = constructWorldBox(gBBox) # Create the default scene graph #gRoot = VisusSceneNode.construct() gRoot = VisusGroup.construct() if not gRoot.setValue(gBBox): print "Error occurred setting bbox" gRoot.mapToWorldBox(box) gRoot.drawBoundingBox(True) gFocus = gRoot colorMap = banded()
glutInitWindowSize(winWidth, winHeight) glutInitWindowPosition(200, 200) gWindow = glutCreateWindow("ViSUS Tick Marks Test") glutDisplayFunc(display) glutReshapeFunc(reshape) glutMouseFunc(mouse) glutKeyboardFunc(keyboard) glutMotionFunc(motion) glutIdleFunc(idle) #initDisplay() # Create the default scene graph bbox = VisusBoundingBox() bbox.set(-5, -5, -5, 5, 5, 5) #gRoot = VisusGroup.construct() gRoot = VisusSceneNode.construct() gRoot.setValue(bbox) gRoot.drawBoundingBox(True) gFocus = gRoot # Create Font font = VisusFont() font.fontSize(5) # Create Tick Marks xTickMarks = VisusTickMarks.construct() axis = xTickMarks.axis() axis.legendText(" Test this X-Axis") axis.labelFont(font)
glutInitDisplayMode( GLUT_DOUBLE | GLUT_RGBA | GLUT_DEPTH | GLUT_MULTISAMPLE ) glutInitWindowSize(winWidth, winHeight) glutInitWindowPosition(200, 200) window = glutCreateWindow("ViSUS Earth Test") glutDisplayFunc( display ) glutReshapeFunc( reshape ) glutMouseFunc( mouse ) glutKeyboardFunc( keyboard ) glutMotionFunc( motion ) glutIdleFunc( idle ) # Create the default scene graph gBBox = VisusBoundingBox() gBBox.set(-5,-5,-5,5,5,5) gRoot = VisusSceneNode.construct() gRoot.setValue(gBBox) gFocus = gRoot # Create Earth Radius radius = VisusEarthRadius() radius.set(3.0) # Create Earth earth = VisusEarthNode.construct() earth.setValue(radius) gRoot.attachSubTree(earth) gFocus = earth # Load Texture If Given