def update(self, event):
     '''Update projection in viewer when an event is detected'''
     #print event
     #if self.isChange:
         #self.projection = self.image.projectVolumeDouble(rot, tilt, psi)
     Z = flipud(getImageData(self.projection))
     self.projectionImage.updateData(Z) 
Example #2
0
 def __init__(self, filename=None, dim=512, dpi=96, image=None, label=None):
     
     dpi = min(dpi, dim)
     
     if filename is None and image is None:
         reportError("You should provide image or filename")
 
     import xmipp
     #from pylab import axes, Slider
     from protlib_xmipp import getImageData
     
     
     h = 0.5
     lf0 = 0.15
     hf0 = 0.35
     axcolor = 'lightgoldenrodyellow'
     
     if image is None:
         image = xmipp.Image()
         image.readPreview(filename, dim)
     if filename is None:
         filename = "No filename"
         
     xdim, ydim, zdim, n = image.getDimensions()
     Z = getImageData(image)
     xdim += 10
     ydim += 10
     figure = Figure(figsize=(xdim/dpi, ydim/dpi), dpi=dpi, frameon=False)
     # a tk.DrawingArea
     self.root = tk.Tk()
     self.root.title(filename)
     self.imagePreview=ImagePreview(self.root,dim, dpi)
     self.imagePreview.updateData(Z)
 def openVolume(self):
     '''Open Volume, send through the socket, create first projection and visualize it and create parallel thread for incoming events'''
     self.image = xmipp.Image(self.file)
     xdim, ydim, zdim, n = self.image.getDimensions()
     Z = getImageData(self.image)
     self.image.convert2DataType(xmipp.DT_DOUBLE)
     
     from multiprocessing.connection import Client
     address = (self.address, self.port)
     self.conn = Client(address, authkey=self.authkey)
     self.conn.send(Z)
 
     self.projection = self.image.projectVolumeDouble(0,0,0)
         
     self.process_check = True
     self.process_thread = threading.Thread(target=self.communication)
     self.process_thread.start()
         
     from protlib_gui_figure import ImageWindow
     self.projectionImage = ImageWindow(image=self.projection,label="Projection")
     
     self.projectionImage.root.bind('<<NewProjection>>', self.update)
     #self.update()
     self.projectionImage.show()
Example #4
0
 def updateImage(self, image):
     from protlib_xmipp import getImageData
     Z = getImageData(image)
     self.imagePreview.updateData(Z)