def _runButton_fired(self): if self.dataDir == "" or self.mapFile=="" or self.colorFile=="": self.log += "Please Complete the upper part.\n" else: start_time = time() if self.volume is None: # Disable Render to save calculate self.scene.disable_render = True # Set Background to black self.scene.background = (0,0,0) # Load Data self.data = loadData(self.dataDir) # Draw Background Map self.map = drawMap(self.mlab, self.data, self.mapFile) changeToBestView(self.mlab) # Draw 3d volume graph self.volume = drawVolume(self.mlab,self.data) self.colormap = readColorFile(self.colorFile) changeVolumeColormap(self.volume,self.colormap) changeToBestView(self.mlab) # Enable Render self.scene.disable_render = False # For Update self.dataDirChanged = False self.mapFileChanged = False self.colorFileChanged = False self.log += "Created 3d visualization\n" else: # Change 3d volume graph if self.dataDirChanged: self.data = loadData(self.dataDir) self.mlab_source.set(scalars = self.data) self.dataDirChanged = False self.log += "Updated 3d data.\n" # Change Color Map elif self.colorFileChanged: self.colormap = readColorFile(self.colorFile) changeVolumeColormap(self.volume,self.colormap) self.colorFileChanged = False self.log += "Updated Colormap.\n" # Change Background Map elif self.mapFileChanged: self.map.remove() self.map = drawMap(self.mlab, self.data, self.mapFile) changeToBestView(self.mlab) self.mapFileChanged = False self.log += "Updated Background Map.\n" else: self.log += "Nothing Changed\n" self.log += "Work Done. Used %.3f seconds \n\n" %(time()-start_time)
def _colorButton_fired(self): print self.colormap changeVolumeColormap(self.volume,self.colormap) self.colorFileChanged = False self.log += "Updated Colormap.\n"