Example #1
0
    def activate(self, sidebarwin):
        """
		Set the mode of visualization
		"""
        scripting.wantWholeDataset = 1
        self.sidebarWin = sidebarwin

        x, y = self.getSidebarWinOrigSize()
        if not self.iactivePanel:
            Logging.info("Generating preview", kw="visualizer")
            self.iactivePanel = MIPPreviewFrame(self.parent)

        if not self.configPanel:
            self.container = wx.SashLayoutWindow(self.sidebarWin)
            self.configPanel = SimpleConfigurationPanel(self.container,
                                                        self.visualizer,
                                                        self,
                                                        size=(x, y))

        self.configPanel.Show()
        self.container.Show()

        return self.iactivePanel
	def activate(self, sidebarwin):
		"""
		Set the mode of visualization
		"""
		scripting.wantWholeDataset = 1
		self.sidebarWin = sidebarwin

		x,y = self.getSidebarWinOrigSize()
		if not self.iactivePanel:
			Logging.info("Generating preview", kw = "visualizer")
			self.iactivePanel = MIPPreviewFrame(self.parent)

		if not self.configPanel:
			self.container = wx.SashLayoutWindow(self.sidebarWin)
			self.configPanel = SimpleConfigurationPanel(self.container, self.visualizer, self, size = (x,y))

		self.configPanel.Show()
		self.container.Show()

		return self.iactivePanel
Example #3
0
class SimpleMode(VisualizationMode):
    def __init__(self, parent, visualizer):
        """
		Initialization
		"""
        VisualizationMode.__init__(self, parent, visualizer)
        self.parent = parent
        self.visualizer = visualizer
        self.iactivePanel = None
        self.dataUnit = None
        self.configPanel = None

    def showSideBar(self):
        """
		Method that is queried to determine whether
					 to show the sidebar
		"""
        return True

    def getSidebarWinOrigSize(self):
        """
		Return default size of sidebar win
		"""
        return (100, 500)

    def Render(self):
        """
		Update the rendering
		"""
        self.iactivePanel.updatePreview(0)

    def updateRendering(self):
        """
		Update the rendering
		"""
        Logging.info("Updating rendering", kw="preview")
        self.iactivePanel.updatePreview(1)

    def setBackground(self, r, g, b):
        """
		Set the background color
		"""
        if self.iactivePanel:
            self.iactivePanel.setBackgroundColor((r, g, b))

    def activate(self, sidebarwin):
        """
		Set the mode of visualization
		"""
        scripting.wantWholeDataset = 1
        self.sidebarWin = sidebarwin

        x, y = self.getSidebarWinOrigSize()
        if not self.iactivePanel:
            Logging.info("Generating preview", kw="visualizer")
            self.iactivePanel = MIPPreviewFrame(self.parent)

        if not self.configPanel:
            self.container = wx.SashLayoutWindow(self.sidebarWin)
            self.configPanel = SimpleConfigurationPanel(self.container,
                                                        self.visualizer,
                                                        self,
                                                        size=(x, y))

        self.configPanel.Show()
        self.container.Show()

        return self.iactivePanel

    def setDataUnit(self, dataUnit):
        """
		Set the dataunit to be visualized
		"""
        Logging.info("setDataUnit(", dataUnit, ")", kw="visualizer")
        if dataUnit == self.dataUnit:
            Logging.info("Same dataunit, not changing", kw="visualizer")
            return

        self.iactivePanel.setDataUnit(dataUnit, 0)

    def setTimepoint(self, tp):
        """
		Set the timepoint to be visualized
		"""
        Logging.info("Setting timepoint to ", tp, kw="visualizer")
        self.iactivePanel.setTimepoint(tp)

    def deactivate(self, newmode=None):
        """
		Unset the mode of visualization
		"""
        self.iactivePanel.Show(0)
        self.iactivePanel.onDeactivate()
        self.iactivePanel.Destroy()
        del self.iactivePanel
        self.iactivePanel = None

    def saveSnapshot(self, filename):
        """
		Save a snapshot of the scene
		"""
        self.iactivePanel.saveSnapshot(filename)
class SimpleMode(VisualizationMode):

	def __init__(self, parent, visualizer):
		"""
		Initialization
		"""
		VisualizationMode.__init__(self, parent, visualizer)	
		self.parent = parent
		self.visualizer = visualizer
		self.iactivePanel = None
		self.dataUnit = None
		self.configPanel = None
		
	def showSideBar(self):
		"""
		Method that is queried to determine whether
					 to show the sidebar
		"""
		return True

	def getSidebarWinOrigSize(self):
		"""
		Return default size of sidebar win
		"""
		return (100,500)
	
	def Render(self):
		"""
		Update the rendering
		"""		 
		self.iactivePanel.updatePreview(0)
		
	def updateRendering(self):
		"""
		Update the rendering
		"""
		Logging.info("Updating rendering", kw = "preview")
		self.iactivePanel.updatePreview(1)
		
	def setBackground(self, r, g, b):
		"""
		Set the background color
		"""		 
		if self.iactivePanel:
			self.iactivePanel.setBackgroundColor((r, g, b))

	def activate(self, sidebarwin):
		"""
		Set the mode of visualization
		"""
		scripting.wantWholeDataset = 1
		self.sidebarWin = sidebarwin

		x,y = self.getSidebarWinOrigSize()
		if not self.iactivePanel:
			Logging.info("Generating preview", kw = "visualizer")
			self.iactivePanel = MIPPreviewFrame(self.parent)

		if not self.configPanel:
			self.container = wx.SashLayoutWindow(self.sidebarWin)
			self.configPanel = SimpleConfigurationPanel(self.container, self.visualizer, self, size = (x,y))

		self.configPanel.Show()
		self.container.Show()

		return self.iactivePanel
		
	def setDataUnit(self, dataUnit):
		"""
		Set the dataunit to be visualized
		"""
		Logging.info("setDataUnit(", dataUnit, ")", kw = "visualizer")
		if dataUnit == self.dataUnit:
			Logging.info("Same dataunit, not changing", kw = "visualizer")
			return

		self.iactivePanel.setDataUnit(dataUnit, 0)
		
	def setTimepoint(self, tp):
		"""
		Set the timepoint to be visualized
		"""
		Logging.info("Setting timepoint to ", tp, kw = "visualizer")
		self.iactivePanel.setTimepoint(tp)
		
	def deactivate(self, newmode = None):
		"""
		Unset the mode of visualization
		"""
		self.iactivePanel.Show(0)
		self.iactivePanel.onDeactivate()
		self.iactivePanel.Destroy()
		del self.iactivePanel
		self.iactivePanel = None
		
	def saveSnapshot(self, filename):
		"""
		Save a snapshot of the scene
		"""		 
		self.iactivePanel.saveSnapshot(filename)