def addRoi(self, x=None, y=None, width=None, height=None, angle=0): #To get the current GUI situation guibean=RCPPlotter.getGuiBean(self.panel); roi = guibean.getROI() roiList=guibean[GuiParameters.ROIDATALIST] if None in [x, y, width, height, angle]:#No ROI parameter defined. print "No ROI info defined in the command. Use GUI ROI box selection" if roi is None: # No ROI selection on the gui print "Can not add ROI. Please either give ROI five parameters or draw a box in the GUI"; return; else: roi = RectangularROI(x,y, width, height, angle); if roiList is None:#No ROI Table on the gui roiList = RectangularROIList(); roiList.add(roi); #Update the view with new ROI table # guibean=GuiBean(); guibean[GuiParameters.ROIDATALIST] = roiList; RCPPlotter.setGuiBean(self.panel, guibean); self.getRoiTable();
def addRoi(self, x=None, y=None, width=None, height=None, angle=0): #To get the current GUI situation guibean = RCPPlotter.getGuiBean(self.panel) #roi=gbean.get(GuiParameters.ROIDATA) roi = guibean[GuiParameters.ROIDATA] roiList = guibean[GuiParameters.ROIDATALIST] if None in [x, y, width, height, angle]: #No ROI parameter defined. print "No ROI info defined in the command. Use GUI ROI box selection" if roi is None: # No ROI selection on the gui print "Can not add ROI. Please either give ROI five parameters or draw a box in the GUI" return else: roi = RectangularROI(x, y, width, height, angle) if roiList is None: #No ROI Table on the gui roiList = RectangularROIList() roiList.add(roi) #Update the view with new ROI table guibean = GuiBean() guibean[GuiParameters.ROIDATALIST] = roiList RCPPlotter.setGuiBean(self.panel, guibean) self.getRoiTable()
def clearRois(self): guibean=RCPPlotter.getGuiBean(self.panel); if GuiParameters.ROIDATALIST in guibean: guibean[GuiParameters.ROIDATALIST]=None; RCPPlotter.setGuiBean(self.panel, guibean); self.roiList = []; self.updateRoiList();
def clearRoi(self): roi = RectangularROI() roiList = RectangularROIList() guibean = GuiBean() guibean[GuiParameters.ROIDATA] = roi guibean[GuiParameters.ROIDATALIST] = roiList RCPPlotter.setGuiBean(self.panel, guibean) self.updateRoiList()
def display(self, fileName): if fileName is None: print "Please give a full file name to display"; return; else: dataset = self.loadDataset(fileName) if self.panel: RCPPlotter.imagePlot(self.panel, dataset); else: print "No panel set to display" raise Exception("No panel_name set in %s. Set this or set %s.setAlive(False)" % (self.name,self.name));
def display(self,dataset=None): if dataset is None: if self.dataset is None: print "No dataset to display"; return; else: dataset = self.dataset; if self.panel: RCPPlotter.imagePlot(self.panel, dataset); else: print "No panel set to display" raise Exception("No panel_name set in %s. Set this or set %s.setAlive(False)" % (self.name,self.name));
def display(self, dataset=None): if dataset is None: if self.dataset is None: print "No dataset to display"; return; else: dataset = self.dataset; if self.panel: RCPPlotter.imagePlot(self.panel, dataset); else: print "No panel set to display" raise Exception("No panel_name set in %s. Set this or set %s.setAlive(False)" % (self.name,self.name));
def updateRoiList(self): guibean = RCPPlotter.getGuiBean(self.panel) roiList = guibean[GuiParameters.ROIDATALIST] if isinstance(roiList, RectangularROIList): self.roiList = roiList if self.roiList is None: raise RuntimeError("No ROI Defined Error")
def getRoiSelectionBox(self): #Get current ROI info from the View guibean=RCPPlotter.getGuiBean(self.panel); roi = guibean.getROI() if roi is None: print None; else: print self.getRoiParameters(roi); return roi;
def display(self,file=None): if file==None: file = self.getFullFileName() fileLoader = UViewDetectorClass.ImageFileLoaders[os.path.splitext(file)[-1].split('.')[-1].upper()]; self.data.load( fileLoader(file) ); dataset = self.data.getAxis(0); if self.panel: if self.logScale: RCPPlotter.imagePlot(self.panel, DatasetUtils.lognorm(dataset)); #For RCP GUI else: RCPPlotter.imagePlot(self.panel, dataset); #For RCP GUI else: print "No panel set to display" raise Exception("No panel_name set in %s. Set this or set %s.setAlive(False)" % (self.name,self.name));
def display(self, file=None): if file == None: file = self.getFullFileName() # self.data.loadPilatusData(file) self.data.load(PilatusTiffLoader(file)) dataset = self.data.getAxis(0) if self.panel: if self.logScale: RCPPlotter.imagePlot(self.panel, DatasetMaths.lognorm(dataset)) #For RCP GUI else: RCPPlotter.imagePlot(self.panel, dataset) #For RCP GUI else: print "No panel set to display" raise Exception( "No panel_name set in %s. Set this or set %s.setAlive(False)" % (self.name, self.name))
def getRoiSelectionBox(self): #Get current ROI info from the View guibean = RCPPlotter.getGuiBean(self.panel) #roi=gbean.get(GuiParameters.ROIDATA) roi = guibean[GuiParameters.ROIDATA] if roi is None: print None else: print self.getRoiParameters(roi) return roi
def getRoi(self): #Get the ROI info from GUI #To get the current GUI situation guibean = RCPPlotter.getGuiBean(self.panel) roiList = guibean[GuiParameters.ROIDATALIST] # for roi in roiList: # [x,y,w,h,angle]=self.getRoiParameters(roi); roi = roiList[0] [x, y, w, h, angle] = self.getRoiParameters(roi) return roi
def updateRoiList(self): guibean=RCPPlotter.getGuiBean(self.panel); roiList=guibean[GuiParameters.ROIDATALIST]; tempRoiList=[]; if not isinstance(roiList, RectangularROIList):#No rectangular roi list defined. return else: for roi in roiList: if isinstance(roi, RectangularROI): tempRoiList.append(roi); self.roiList = tempRoiList;
#Example images from : "/dls/i06/data/2010/si0/28431_UViewImage" or "/home/xr56/testData/28431_UViewImage/" from gda.analysis import RCPPlotter import scisoftpy.plot as dpl run "scisoft/peem_analysis" pp=RCPPlotter() sourceDir = "/dls/i06/tmp/test" targetDir = "/dls/i06/tmp/test" #To load image #pp.scanForImages("Image Explorer", "/dls/i06/data/2010/cm1895-1/demoImages") #pp.scanForImages("Image Explorer", sourceDir) load_peem(sourceDir); #Users need to select the images and send them to server. [cdMap, positiveImage, negativeImage, averageImages] = process_peem(targetDir) #to plot cd map dpl.image(cdMap, name="PEEM Image") #to plot the positive image dpl.image(positiveImage, name="PEEM Image") #to plot the negative image dpl.image(negativeImage, name="PEEM Image")
def setPlotMode(self, plotmode=GuiPlotMode.TWOD): # guibean=GuiBean(); guibean=RCPPlotter.getGuiBean(self.panel); guibean[GuiParameters.PLOTMODE]=plotmode; RCPPlotter.setGuiBean(self.panel, guibean);
from gda.analysis import RCPPlotter from uk.ac.diamond.scisoft.analysis.plotserver import GuiBean from uk.ac.diamond.scisoft.analysis.plotserver import GuiParameters from org.eclipse.dawnsci.analysis.dataset.roi import RectangularROI, RectangularROIList from org.eclipse.january.dataset import DatasetFactory pp = RCPPlotter() pp.plot("Area Detector", DatasetFactory.createFromObject(range(100))) #This is used to plot on the PlotView #d = DataSet.arange(10000) #d.shape = [100,100] d = DatasetFactory.createRange(10000) d.shape = [100, 100] # or, d = DataSet.arange(10000).reshape((100,100)) in GDA v8.12 pp.imagePlot("Area Detector", d) #This is used to plot on the ImageExploreView pp.plotImageToGrid("Image Explorer", DatasetFactory.ones([20, 30])) pp.plotImageToGrid("Image Explorer", "/home/xr56/temp/p100kImage26455.tif") #RCPPlotter().plotImageToGrid("Image Explorer","/home/xr56/temp/pilatus100K/p686905.tif") RCPPlotter().scanForImages("Image Explorer", "/dls/i06/data/2010/cm1895-1/demoImages") #ROI #Get ROI info
def setPlotMode(self, plotmode=GuiPlotMode.TWOD): guibean = GuiBean() guibean[GuiParameters.ROIDATA] = plotmode RCPPlotter.setGuiBean(self.panel, guibean)