Exemplo n.º 1
0
  def addWebActor(self):
    self.webView = qt.QWebView()
    self.webView.setWindowFlags(0x800)
    self.webView.setStyleSheet('background:transparent;')

    w, h = self.sliceView.width,self.sliceView.height
    self.qImage = qt.QImage(w, h, qt.QImage.Format_ARGB32)
    self.vtkImage = vtk.vtkImageData()

    self.mapper = vtk.vtkImageMapper()
    self.mapper.SetColorLevel(128)
    self.mapper.SetColorWindow(255)
    self.mapper.SetInput(self.vtkImage)
    self.actor2D = vtk.vtkActor2D()
    self.actor2D.SetMapper(self.mapper)

    self.imageActor = vtk.vtkImageActor()
    #self.imageActor.SetPosition(0,-1000,0)
    self.renderWindow = self.sliceView.renderWindow()
    self.renderer = self.renderWindow.GetRenderers().GetItemAsObject(0)
    self.renderer.AddActor2D(self.actor2D)

    globals()['slicer'].ia = self.imageActor

    self.webView.connect('loadFinished(bool)', lambda worked : self.onLoadFinished(worked) )
    #self.webView.page().connect('repaintRequested(QRect)', lambda rect : onLoadFinished(rect, self.webView, self.qImage) )

    self.style = self.sliceView.interactor()
    events = ("ModifiedEvent", "MouseMoveEvent", "EnterEvent", "LeaveEvent",)
    for event in events:
      tag = self.style.AddObserver(event, self.processEvent)
      self.observerTags.append([self.style,tag])
Exemplo n.º 2
0
  def addWebActor(self):
    self.webView = qt.QWebView()
    self.webView.setWindowFlags(0x800)
    self.webView.setStyleSheet('background:transparent;')

    self.qImage = qt.QImage(1000,1000, qt.QImage.Format_ARGB32)
    self.vtkImage = vtk.vtkImageData()

    lm = slicer.app.layoutManager()
    redWidget = lm.sliceWidget('Red')
    self.threeDView = lm.threeDWidget(0).threeDView()

    self.imageActor = vtk.vtkImageActor()
    self.imageActor.SetPosition(0,-1000,0)
    self.renderWindow = self.threeDView.renderWindow()
    self.renderer = self.renderWindow.GetRenderers().GetItemAsObject(0)
    self.renderer.AddActor(self.imageActor)

    globals()['slicer'].modules.ModelDrawEffectWidget.ia = self.imageActor

    self.webView.connect('loadFinished(bool)', lambda worked : self.onLoadFinished(worked) )