Ejemplo n.º 1
0
 def callbackScroll(self, widget=None, event=None):
     # Call function to update the image.
     img = self.modelCollection.updateSliceImage(self.slider.get_value() -
                                                 1)
     # Get the image from the slice buffer and convert it to 3 channels.
     img = imageHandling.convertSingle2RGB(img)
     # Write image to pixbuf.
     self.pixbuf = gtk.gdk.pixbuf_new_from_array(img,
                                                 gtk.gdk.COLORSPACE_RGB, 8)
     # Resize the pixbuf.
     self.pixbuf = self.pixbuf.scale_simple(
         self.width, self.height, gtk.gdk.INTERP_BILINEAR)  #INTERP_NEAREST)
     # Set image to viewer.
     self.imageView.set_from_pixbuf(self.pixbuf)
     # Set current page label.
     self.currentLabel.set_text(str(int(self.slider.get_value())))
     # Call custom functions if specified.
     if self.customFunctions != None:
         for function in self.customFunctions:
             # Check if function wants sliceNumber argument.
             val = None
             for arg in inspect.getargspec(function)[0]:
                 if arg == 'sliceNumber':
                     val = self.slider.get_value()
             # Run function.
             if val != None: function(val)
             else: function()
Ejemplo n.º 2
0
	def updateImage(self):
		# Call function to update the image.
		img = self.modelCollection.updateSliceImage(self.slider.get_value()-1)
		# Get the image from the slice buffer and convert it to 3 channels.
		img = imageHandling.convertSingle2RGB(img)
		# Write image to pixbuf.
		self.pixbuf = gtk.gdk.pixbuf_new_from_array(img, gtk.gdk.COLORSPACE_RGB, 8)
		# Resize the image.
		self.pixbuf = self.pixbuf.scale_simple(self.width, self.height, gtk.gdk.INTERP_BILINEAR)
		# Set image to viewer.
		self.imageView.set_from_pixbuf(self.pixbuf)
Ejemplo n.º 3
0
 def updateImage(self):
     # Call function to update the image.
     img = self.modelCollection.updateSliceImage(self.slider.get_value() -
                                                 1)
     # Get the image from the slice buffer and convert it to 3 channels.
     img = imageHandling.convertSingle2RGB(img)
     # Write image to pixbuf.
     self.pixbuf = gtk.gdk.pixbuf_new_from_array(img,
                                                 gtk.gdk.COLORSPACE_RGB, 8)
     # Resize the image.
     self.pixbuf = self.pixbuf.scale_simple(self.width, self.height,
                                            gtk.gdk.INTERP_BILINEAR)
     # Set image to viewer.
     self.imageView.set_from_pixbuf(self.pixbuf)
Ejemplo n.º 4
0
	def updateImage(self, sliceNumber):
		if sliceNumber != -1:
			image = self.modelCollection.updateSliceImage(sliceNumber)
			# Get the image from the slice buffer and convert it to 3 channels.
			image = imageHandling.convertSingle2RGB(image)
			# Write image to pixbuf.
			self.pixbuf = gtk.gdk.pixbuf_new_from_array(image, gtk.gdk.COLORSPACE_RGB, 8)
			# Resize the image if in debug mode.
			if self.debug:
				self.pixbuf = self.pixbuf.scale_simple(self.get_size()[0], self.get_size()[1], gtk.gdk.INTERP_BILINEAR)
		else:
			# Create pixbuf from numpy.
			self.pixbuf = gtk.gdk.pixbuf_new_from_array(self.imageBlack, gtk.gdk.COLORSPACE_RGB, 8)
		# Set pixbuf.
		self.imageView.set_from_pixbuf(self.pixbuf)		
Ejemplo n.º 5
0
    def callbackScroll(self, widget=None, event=None):
        currentSliceNumber = 0
        if len(self.modelCollection.sliceStackPreview) > 1:
            # Call function to update the image. Zero based indexing!
            # Catch index out of bounds exception and display black image instead.
            try:
                # Get the image from the slice buffer and convert it to 3 channels.
                img = self.modelCollection.updateSliceImage(
                    self.slider.get_value() - 1, mode="preview")
                img = imageHandling.convertSingle2RGB(img)
                # Get current slice number.
                currentSliceNumber = int(self.modelCollection.sliceNumbers[int(
                    self.slider.get_value() - 1)])
                # Set current page label.
                self.currentLabel.set_text(str(currentSliceNumber + 1))
            except IndexError:
                img = self.imageBlack
                self.currentLabel.set_text("Please wait.")
                currentSliceNumber = 0
            # Write image to pixbuf.
            self.pixbuf = gtk.gdk.pixbuf_new_from_array(
                img, gtk.gdk.COLORSPACE_RGB, 8)
            # Resize the pixbuf.
            if img.shape[1] != self.width:
                self.pixbuf = self.pixbuf.scale_simple(
                    self.width, self.height,
                    gtk.gdk.INTERP_BILINEAR)  #INTERP_NEAREST)
            # Set image to viewer.
            self.imageView.set_from_pixbuf(self.pixbuf)

        else:
            img = self.imageBlack
            self.currentLabel.set_text("Please wait.")
            currentSliceNumber = 0

        # Call custom functions if specified.
        if self.customFunctions != None:
            for function in self.customFunctions:
                # Check if function wants sliceNumber argument.
                val = None
                for arg in inspect.getargspec(function)[0]:
                    if arg == 'sliceNumber':
                        val = currentSliceNumber  #self.modelCollection.sliceNumbers[int(self.slider.get_value()-1)]# * self.modelCollection.getPreviewSliceHeight()
                # Run function.
                if val != None: function(val)
                else: function()
Ejemplo n.º 6
0
 def updateImage(self, sliceNumber):
     if sliceNumber != -1:
         image = self.modelCollection.updateSliceImage(sliceNumber)
         # Get the image from the slice buffer and convert it to 3 channels.
         image = imageHandling.convertSingle2RGB(image)
         # Write image to pixbuf.
         self.pixbuf = gtk.gdk.pixbuf_new_from_array(
             image, gtk.gdk.COLORSPACE_RGB, 8)
         # Resize the image if in debug mode.
         #if self.settings['Debug'].value:
         if self.resizeFlag:
             self.pixbuf = self.pixbuf.scale_simple(self.width, self.height,
                                                    gtk.gdk.INTERP_BILINEAR)
     else:
         # Create pixbuf from numpy.
         self.pixbuf = gtk.gdk.pixbuf_new_from_array(
             self.imageBlack, gtk.gdk.COLORSPACE_RGB, 8)
     # Set pixbuf.
     self.set_from_pixbuf(self.pixbuf)
Ejemplo n.º 7
0
 def updateImage(self, sliceNumber):
     #		print "3: Started image update at " + str(time.time()) + "."
     if sliceNumber != -1:
         image = self.modelCollection.updateSliceImage(sliceNumber)
         # Get the image from the slice buffer and convert it to 3 channels.
         image = imageHandling.convertSingle2RGB(image)
         # Write image to pixbuf.
         self.pixbuf = gtk.gdk.pixbuf_new_from_array(
             image, gtk.gdk.COLORSPACE_RGB, 8)
         # Resize the image if in debug mode.
         if self.debug:
             self.pixbuf = self.pixbuf.scale_simple(self.get_size()[0],
                                                    self.get_size()[1],
                                                    gtk.gdk.INTERP_BILINEAR)
     else:
         # Create pixbuf from numpy.
         self.pixbuf = gtk.gdk.pixbuf_new_from_array(
             self.imageBlack, gtk.gdk.COLORSPACE_RGB, 8)
     # Set pixbuf.
     self.imageView.set_from_pixbuf(self.pixbuf)
Ejemplo n.º 8
0
	def callbackScroll(self, widget=None, event=None):
		# Call function to update the image.
		img = self.modelCollection.updateSliceImage(self.slider.get_value()-1)
		# Get the image from the slice buffer and convert it to 3 channels.
		img = imageHandling.convertSingle2RGB(img)
		# Write image to pixbuf.
		self.pixbuf = gtk.gdk.pixbuf_new_from_array(img, gtk.gdk.COLORSPACE_RGB, 8)
		# Resize the pixbuf.
		self.pixbuf = self.pixbuf.scale_simple(self.width, self.height, gtk.gdk.INTERP_BILINEAR)#INTERP_NEAREST)
		# Set image to viewer.
		self.imageView.set_from_pixbuf(self.pixbuf)	
		# Set current page label.
		self.currentLabel.set_text(str(int(self.slider.get_value())))	
		# Call custom functions if specified.
		if self.customFunctions != None:
			for function in self.customFunctions:
				# Check if function wants sliceNumber argument.
				val = None
				for arg in inspect.getargspec(function)[0]:
					if arg == 'sliceNumber':
						val = self.slider.get_value()
				# Run function.
				if val != None: function(val)
				else: function()