Esempio n. 1
0
  def _setupLayouts( self ):
    layoutNode = slicer.mrmlScene.GetNthNodeByClass(0, "vtkMRMLLayoutNode")
    if layoutNode is None:
      return

    if not self._layouts:
      tag = 'Input'
      for i in range(1, self.maximumNumberOfInput + 1):
        self._layouts.append(self._inputLayout(tag, i))

      # Add the special 1 slice-1 3D view layout
      self._layouts.append(self._inputLayout(tag, 1, True))

      oldView = layoutNode.GetViewArrangement()
      # The slice composite node are created when the layout is used.
      # To be able to manipulate thgem correctly, we'll select the layouts
      # after their creation
      for i, layout in enumerate(self._layouts, start=1):
        view = slicer.vtkMRMLLayoutNode().SlicerLayoutUserView + i
        layoutNode.AddLayoutDescription(view, layout)
        layoutNode.SetViewArrangement(view)

        # Prevent the layout slice composite node to update when a node is added
        sliceCompositeNode = slicer.mrmlScene.GetNodeByID('vtkMRMLSliceCompositeNode' + tag + str(i))
        if sliceCompositeNode:
          sliceCompositeNode.SetDoPropagateVolumeSelection(False)
Esempio n. 2
0
    def _setupLayouts(self):
        layoutNode = slicer.mrmlScene.GetNthNodeByClass(0, "vtkMRMLLayoutNode")
        if layoutNode is None:
            return

        if not self._layouts:
            tag = 'Input'
            for i in range(1, self.maximumNumberOfInput + 1):
                self._layouts.append(self._inputLayout(tag, i))

            # Add the special 1 slice-1 3D view layout
            self._layouts.append(self._inputLayout(tag, 1, True))

            oldView = layoutNode.GetViewArrangement()
            # The slice composite node are created when the layout is used.
            # To be able to manipulate thgem correctly, we'll select the layouts
            # after their creation
            for i, layout in enumerate(self._layouts, start=1):
                view = slicer.vtkMRMLLayoutNode().SlicerLayoutUserView + i
                layoutNode.AddLayoutDescription(view, layout)
                layoutNode.SetViewArrangement(view)

                # Prevent the layout slice composite node to update when a node is added
                sliceCompositeNode = slicer.mrmlScene.GetNodeByID(
                    'vtkMRMLSliceCompositeNode' + tag + str(i))
                if sliceCompositeNode:
                    sliceCompositeNode.SetDoPropagateVolumeSelection(False)
Esempio n. 3
0
  def updateLayout( self, numberOfViews ):
    if numberOfViews not in range(1, len(self._layouts) + 1):
      print 'This should not happen, the number of inputs should be in [1, %i[' %(len(self._layouts) + 1)
      return

    layoutNode = slicer.mrmlScene.GetNthNodeByClass(0, "vtkMRMLLayoutNode")
    if layoutNode is None:
      return

    newLayout = slicer.vtkMRMLLayoutNode().SlicerLayoutUserView + numberOfViews
    self._CurrentViewID = numberOfViews
    layoutNode.SetViewArrangement(newLayout)
    slicer.app.applicationLogic().FitSliceToAll()
Esempio n. 4
0
    def updateLayout(self, numberOfViews):
        if numberOfViews not in range(1, len(self._layouts) + 1):
            print 'This should not happen, the number of inputs should be in [1, %i[' % (
                len(self._layouts) + 1)
            return

        layoutNode = slicer.mrmlScene.GetNthNodeByClass(0, "vtkMRMLLayoutNode")
        if layoutNode is None:
            return

        newLayout = slicer.vtkMRMLLayoutNode(
        ).SlicerLayoutUserView + numberOfViews
        self._CurrentViewID = numberOfViews
        layoutNode.SetViewArrangement(newLayout)
        slicer.app.applicationLogic().FitSliceToAll()