Пример #1
0
    def addIsoSurface(self, isoData, isoValue=0):

        print "Add Isosurface"

        # Create the 3D extractor
        self._isoExtract, bbox, self._iso_description = VisusFunctions.create3dExtractor(
            isoData)

        # Attach the extractor to the passed in slice
        self._root.attachSubTree(self._isoExtract, True)

        # Create the isosurface
        surface = VisusIsoSurface.construct()

        # Create the mesh display
        display = VisusMeshDisplay.construct()
        display.normalIndex(3)

        self._isoExtract.attachSubTree(surface)
        surface.attachSubTree(display)

        # Connect the output of the extractor to the input of each surface node
        if not surface.connectIso(self._isoExtract):
            raise RuntimeError("unable to connect extractor1 as surface input")

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

        # Set the isosurface
        iso = VisusIsoValue(isoValue)
        surface.setValue(iso)
Пример #2
0
  def addIsoSurface( self, isoData, isoValue=0 ):
    
    print "Add Isosurface"

    # Create the 3D extractor
    self._isoExtract, bbox, self._iso_description = VisusFunctions.create3dExtractor( isoData )

    # Attach the extractor to the passed in slice
    self._root.attachSubTree(self._isoExtract, True)

    # Create the isosurface
    surface = VisusIsoSurface.construct()

    # Create the mesh display
    display = VisusMeshDisplay.construct()
    display.normalIndex(3)

    self._isoExtract.attachSubTree(surface)
    surface.attachSubTree(display)
    
    # Connect the output of the extractor to the input of each surface node
    if not surface.connectIso(self._isoExtract):
      raise RuntimeError("unable to connect extractor1 as surface input")
    
    if not display.connectInput(surface):
      raise RuntimeError("unable to connect surface as display input")

    # Set the isosurface
    iso = VisusIsoValue(isoValue)
    surface.setValue(iso)
Пример #3
0
    def addIso(self, extractor):

        # Create the nodes for surface of data
        surface = VisusIsoSurface.construct()

        # Create Projector and Projection
        proj = VisusSphereProjection()
        projector = VisusProjector.construct()
        projector.declareParameter(
            11
        )  # projector->declareParameter(VisusSharedEarthRadius::sTypeIndex);
        projector.projection(proj)

        # set radius
        ShareRadius = VisusSharedEarthRadius()
        radius = self._radius.get() * 1.25
        ShareRadius.set(radius)
        projector.setValue(ShareRadius)

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

        # Attach the surface as sub trees of the extractors
        extractor.attachSubTree(surface, True)
        surface.attachSubTree(projector, True)
        projector.attachSubTree(display, True)
        #surface.attachSubTree(display, True)

        # Connect the output of the extractor to the input of each surface node
        if not surface.connectIso(extractor):
            raise RuntimeError("unable to connect extractor as surface input")

        # Connect the output of the projector to the input of each extractor node
        if not projector.connectInput(surface):
            raise RuntimeError("unable to connect surface as projector input")

        # Connect the output of the display to the input of each surface node
        if not display.connectInput(projector):
            raise RuntimeError("unable to connect projector as display input")

        # Draw the bounding boxes of the surface
        surface.drawBoundingBox(False)

        return surface
Пример #4
0
  def addIso(self, extractor):

    # Create the nodes for surface of data
    surface = VisusIsoSurface.construct()

     # Create Projector and Projection
    proj = VisusSphereProjection()
    projector = VisusProjector.construct()
    projector.declareParameter(11) # projector->declareParameter(VisusSharedEarthRadius::sTypeIndex);
    projector.projection(proj)

    # set radius
    ShareRadius = VisusSharedEarthRadius()
    radius = self._radius.get()*1.25
    ShareRadius.set(radius)
    projector.setValue(ShareRadius)
 
    # Create Display
    display = VisusMeshDisplay.construct()
    display.normalIndex(3)
    
    # Attach the surface as sub trees of the extractors
    extractor.attachSubTree(surface, True)
    surface.attachSubTree(projector, True) 
    projector.attachSubTree(display, True)
    #surface.attachSubTree(display, True) 

    # Connect the output of the extractor to the input of each surface node
    if not surface.connectIso(extractor):
      raise RuntimeError("unable to connect extractor as surface input")
    
    # Connect the output of the projector to the input of each extractor node
    if not projector.connectInput(surface):
      raise RuntimeError("unable to connect surface as projector input")
    
    # Connect the output of the display to the input of each surface node
    if not display.connectInput(projector):
      raise RuntimeError("unable to connect projector as display input")
  
    # Draw the bounding boxes of the surface
    surface.drawBoundingBox(False) 

    return surface
Пример #5
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
Пример #6
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
Пример #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