Exemplo n.º 1
0
def addSlice(parent, orientation):
    global gDataSet, gFocus, gValues

    # Get Data
    left = VectorDouble(3)
    right = VectorDouble(3)

    print "Reloading dataset(%s)" % gDataSet
    source = VisusDataSourceFactory.make(gDataSet)
    if not source.isValid():
        raise RuntimeError("Problem loading data set")
    source.domainBoundingBox(left, right)

    # Compute Data Requeset
    request = VisusDataRequest()

    extent = VectorDouble(3)
    extent[0] = 0.9 * (right[0] - left[0])
    extent[1] = 0.9 * (right[1] - left[1])
    extent[2] = 0
    request.extent(extent)
    start = [4, 4, 4]
    end = [1, 1, 1]
    request.setStrides(start, end)
    matrix = translationMatrix(
        (left[0] + right[0]) / 2,
        (left[1] + right[1]) / 2,
        (left[2] + right[2]) / 2,
    )
    request.transformation(matrix)

    # Create Producer
    extractor = VisusAxisAlignedExtractor.construct()
    extractor.setValue(gDataSet)
    extractor.setValue(request)

    # Create Consumer
    slice = VisusOrthogonalSlice.construct()
    slice.orientation(orientation)

    # Attach To Tree
    parent.attachSubTree(extractor)
    extractor.attachSubTree(slice)

    slice.inherit(VisusSharedDataRequest.typeIndex(), True)
    slice.inherit(VisusSharedBoundingBox.typeIndex(), True)
    extractor.setValue(request)
    slice.setValue(request)
    if not slice.connectInput(extractor):
        raise RuntimeError("unable to connect extractor as slice input")

    gFocus = slice

    gValues.extend([slice, extractor])

    return slice
Exemplo n.º 2
0
def addSlice(parent,orientation):
  global gDataSet, gFocus, gValues

  # Get Data
  left = VectorDouble(3)
  right= VectorDouble(3)

  print "Reloading dataset(%s)" % gDataSet
  source = VisusDataSourceFactory.make(gDataSet)
  if not source.isValid():
    raise RuntimeError("Problem loading data set")
  source.domainBoundingBox(left,right)

  # Compute Data Requeset
  request = VisusDataRequest()

  extent = VectorDouble(3)
  extent[0] = 0.9 * (right[0] - left[0])
  extent[1] = 0.9 * (right[1] - left[1])
  extent[2] = 0
  request.extent(extent)
  start = [ 4, 4, 4 ]
  end   = [ 1, 1, 1 ]
  request.setStrides(start,end)
  matrix = translationMatrix((left[0]+right[0])/2,
                             (left[1]+right[1])/2,
                             (left[2]+right[2])/2,
                            )
  request.transformation(matrix)

  # Create Producer
  extractor = VisusAxisAlignedExtractor.construct()
  extractor.setValue(gDataSet)
  extractor.setValue(request)

  # Create Consumer
  slice = VisusOrthogonalSlice.construct()
  slice.orientation(orientation)

  # Attach To Tree
  parent.attachSubTree(extractor)
  extractor.attachSubTree(slice)
  
  slice.inherit(VisusSharedDataRequest.typeIndex(),True)
  slice.inherit(VisusSharedBoundingBox.typeIndex(),True);
  extractor.setValue(request)
  slice.setValue(request)
  if not slice.connectInput(extractor):
      raise RuntimeError("unable to connect extractor as slice input")

  gFocus = slice

  gValues.extend([slice, extractor])

  return slice
Exemplo n.º 3
0
def addIsoSurface(parent):
    global gDataSet, gFocus, gValues

    # Get Data
    left = VectorDouble(3)
    right = VectorDouble(3)

    print "Reloading dataset(%s)" % gDataSet
    source = VisusDataSourceFactory.make(gDataSet)
    if not source.isValid():
        raise RuntimeError("Problem loading data set")
    source.domainBoundingBox(left, right)

    # Compute Data Requeset
    request = VisusDataRequest()

    extent = VectorDouble(3)
    extent[0] = 0.5 * (right[0] - left[0])
    extent[1] = 0.5 * (right[1] - left[1])
    extent[2] = 0.5 * (right[2] - left[2])
    request.extent(extent)
    start = [1, 1, 1]
    end = [1, 1, 1]
    request.setStrides(start, end)
    matrix = translationMatrix(
        (left[0] + right[0]) / 2,
        (left[1] + right[1]) / 2,
        (left[2] + right[2]) / 2,
    )
    request.transformation(matrix)

    # Create Producer
    extractor = VisusAxisAlignedExtractor.construct()

    # Create Consumer
    iso = VisusIsoSurface.construct()

    # Create Display
    display = VisusMeshDisplay.construct()
    display.normalIndex(3)

    # Attach To Tree
    parent.attachSubTree(extractor)
    extractor.attachSubTree(iso)
    iso.attachSubTree(display)

    # Connect Request
    extractor.setValue(gDataSet)
    extractor.setValue(request)

    # Connect Inputs
    if not iso.connectIso(extractor):
        raise RuntimeError("unable to connect extractor as iso input")

    if not display.connectInput(iso):
        raise RuntimeError("unable to connect iso as display input")

    gFocus = iso
    gFocus.drawBoundingBox(True)

    gValues.extend([iso, extractor])

    return iso
Exemplo n.º 4
0
def addSlice(parent, color, height):
    global gFocus, gValues

    # Get Data
    left = VectorDouble(3)
    right = VectorDouble(3)

    print "Reloading dataset(%s)" % color
    source = VisusDataSourceFactory.make(color)
    if not source.isValid():
        raise RuntimeError("Problem loading data set")
    source.domainBoundingBox(left, right)

    # Compute Data Requeset
    request = VisusDataRequest()

    extent = VectorDouble(3)
    extent[0] = 0.8 * (right[0] - left[0])
    extent[1] = 0.8 * (right[1] - left[1])
    extent[2] = 0
    request.extent(extent)
    start = [8, 8, 8]
    end = [4, 4, 4]
    request.setStrides(start, end)
    matrix = translationMatrix(
        (left[0] + right[0]) / 2.0,
        (left[1] + right[1]) / 2.0,
        (left[2] + right[2]) / 2.0,
    )
    request.transformation(matrix)

    # Create Color Producer
    extractor1 = VisusAxisAlignedExtractor.construct()
    extractor1.setValue(color)

    # Create Height Producer
    extractor2 = VisusAxisAlignedExtractor.construct()
    extractor2.setValue(height)

    # Create Consumer
    hf = VisusHeightField.construct()
    hf.attachSubTree(extractor1)
    hf.attachSubTree(extractor2)
    parent.attachSubTree(hf)

    # Set Data Request
    hf.setValue(request)
    extractor1.inherit(VisusSharedDataRequest.typeIndex(), True)
    extractor2.inherit(VisusSharedDataRequest.typeIndex(), True)
    hf.inherit(VisusSharedBoundingBox.typeIndex(), True)

    # Connect Inputs
    if not hf.connectColor(extractor1):
        raise RuntimeError("unable to connect extractor as color input")

    if not hf.connectHeight(extractor2):
        raise RuntimeError("unable to connect extractor as height input")

    gFocus = hf

    gValues.extend([hf, extractor1, extractor2])

    return hf
Exemplo n.º 5
0
def addIsoSurface(parent):
    global gDataSet, gFocus, gValues, gMinValue, gMaxValue

    # Get Data
    left = VectorDouble(3)
    right = VectorDouble(3)

    print "Reloading dataset(%s)" % gDataSet[ISO_NDX]
    source = VisusDataSourceFactory.make(gDataSet[ISO_NDX])
    if not source.isValid():
        raise RuntimeError("Problem loading data set")
    source.domainBoundingBox(left, right)

    print "right:", right[0], right[1], right[2]
    print "left: ", left[0], left[1], left[2]

    # Compute Data Requeset
    request = VisusDataRequest()

    extent = VectorDouble(3)
    extent[0] = 0.5 * (right[0] - left[0])
    extent[1] = 0.5 * (right[1] - left[1])
    extent[2] = 0.5 * (right[2] - left[2])
    print "extent: ", extent[0], extent[1], extent[2]

    request.extent(extent)
    start = [1, 1, 1]
    end = [1, 1, 1]
    request.setStrides(start, end)
    matrix = translationMatrix((left[0] + right[0]) / 2, (left[1] + right[1]) / 2, (left[2] + right[2]) / 2)
    request.transformation(matrix)

    # Create Producer
    extractorIso = VisusAxisAlignedExtractor.construct()
    extractorIso.setValue(gDataSet[ISO_NDX])

    extractorColor = VisusAxisAlignedExtractor.construct()
    extractorColor.setValue(gDataSet[COLOR_NDX])

    # Create Consumer
    iso = VisusColoredIsoSurface.construct()

    # Create Display
    display = VisusMeshDisplay.construct()
    display.normalIndex(3)
    display.colorIndex(6)
    display.minValue(gMinValue)
    display.maxValue(gMaxValue)
    display.setValue(gColorMap)

    # Attach To Tree
    parent.attachSubTree(iso)
    iso.attachSubTree(extractorIso)
    iso.attachSubTree(extractorColor)
    iso.attachSubTree(display)

    # Connect Request
    # extractorIso.inherit(VisusSharedDataRequest.typeIndex(),True)
    # extractorColor.inherit(VisusSharedDataRequest.typeIndex(),True)
    extractorColor.setValue(request)
    extractorIso.setValue(request)

    # Connect Inputs
    if not iso.connectIso(extractorIso):
        raise RuntimeError("unable to connect extractor as iso input")

    if not iso.connectColor(extractorColor):
        raise RuntimeError("unable to connect extractor as color input")

    if not display.connectInput(iso):
        raise RuntimeError("unable to connect iso as display input")

    gFocus = iso
    gFocus.drawBoundingBox(True)

    gValues.extend([iso, extractorIso, extractorColor])

    return iso
Exemplo n.º 6
0
def addSlice(parent,color,height):
  global gFocus, gValues

  # Get Data
  left = VectorDouble(3)
  right= VectorDouble(3)

  print "Reloading dataset(%s)" % color 
  source = VisusDataSourceFactory.make(color)
  if not source.isValid():
    raise RuntimeError("Problem loading data set")
  source.domainBoundingBox(left,right)

  # Compute Data Requeset
  request = VisusDataRequest()

  extent = VectorDouble(3)
  extent[0] = 0.8 * (right[0] - left[0])
  extent[1] = 0.8 * (right[1] - left[1])
  extent[2] = 0
  request.extent(extent)
  start = [ 8, 8, 8 ]
  end   = [ 4, 4, 4 ]
  request.setStrides(start,end)
  matrix = translationMatrix((left[0]+right[0])/2.0,
                             (left[1]+right[1])/2.0,
                             (left[2]+right[2])/2.0,
                            )
  request.transformation(matrix)

  # Create Color Producer
  extractor1 = VisusAxisAlignedExtractor.construct()
  extractor1.setValue(color)
  
  # Create Height Producer
  extractor2 = VisusAxisAlignedExtractor.construct()
  extractor2.setValue(height)

  # Create Consumer
  hf = VisusHeightField.construct()
  hf.attachSubTree(extractor1)
  hf.attachSubTree(extractor2)
  parent.attachSubTree(hf)

  # Set Data Request
  hf.setValue(request)
  extractor1.inherit(VisusSharedDataRequest.typeIndex(),True)
  extractor2.inherit(VisusSharedDataRequest.typeIndex(),True)
  hf.inherit(VisusSharedBoundingBox.typeIndex(),True)
 
  # Connect Inputs
  if not hf.connectColor(extractor1):
      raise RuntimeError("unable to connect extractor as color input")
  
  if not hf.connectHeight(extractor2):
      raise RuntimeError("unable to connect extractor as height input")

  gFocus = hf

  gValues.extend([hf, extractor1, extractor2])

  return hf 
Exemplo n.º 7
0
def addIsoSurface(parent):
  global gDataSet, gFocus, gValues

  # Get Data
  left = VectorDouble(3)
  right= VectorDouble(3)

  print "Reloading dataset(%s)" % gDataSet
  source = VisusDataSourceFactory.make(gDataSet)
  if not source.isValid():
    raise RuntimeError("Problem loading data set")
  source.domainBoundingBox(left,right)

  # Compute Data Requeset
  request = VisusDataRequest()

  extent = VectorDouble(3)
  extent[0] = 0.5 * (right[0] - left[0])
  extent[1] = 0.5 * (right[1] - left[1])
  extent[2] = 0.5 * (right[2] - left[2])
  request.extent(extent)
  start = [ 1, 1, 1 ]
  end   = [ 1, 1, 1 ]
  request.setStrides(start,end)
  matrix = translationMatrix((left[0]+right[0])/2,
                             (left[1]+right[1])/2,
                             (left[2]+right[2])/2,
                            )
  request.transformation(matrix)

  # Create Producer
  extractor = VisusAxisAlignedExtractor.construct()

  # Create Consumer
  iso = VisusIsoSurface.construct()

  # Create Display
  display = VisusMeshDisplay.construct()
  display.normalIndex(3)

  # Attach To Tree
  parent.attachSubTree(extractor)
  extractor.attachSubTree(iso)
  iso.attachSubTree(display)

  # Connect Request
  extractor.setValue(gDataSet)
  extractor.setValue(request)

  # Connect Inputs
  if not iso.connectIso(extractor):
    raise RuntimeError("unable to connect extractor as iso input")

  if not display.connectInput(iso):
    raise RuntimeError("unable to connect iso as display input")

  gFocus = iso 
  gFocus.drawBoundingBox(True)

  gValues.extend([iso, extractor])

  return iso