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 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 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 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 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 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;
def setPlotMode(self, plotmode=GuiPlotMode.TWOD): # guibean=GuiBean(); guibean=RCPPlotter.getGuiBean(self.panel); guibean[GuiParameters.PLOTMODE]=plotmode; RCPPlotter.setGuiBean(self.panel, guibean);
# 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 gbean = pp.getGuiBean("Area Detector") gbean #{ROIData=Start (36.0000, 27.0000) Size (11.0000,10.0000) Angle 0.00000, PlotMode=2D, PlotID=09421fb4-720f-4847-a40e-e8cafeacba84} gKeys = gbean.keySet() #[ROIData, PlotMode, PlotID] gValues = gbean.values( ) # [Start (36.0000, 27.0000) Size (11.0000,10.0000) Angle 0.00000, 2D, 09421fb4-720f-4847-a40e-e8cafeacba84] roidata = gbean.get("ROIData") roidata = gbean["ROIData"] type(roidata) #<type 'uk.ac.diamond.scisoft.analysis.dataset.roi.RectangularROI'> roidata.getPoint() #array('d', [36.0, 27.0]) roidata.getEndPoint() #array('d', [47.0, 37.0]) roidata.getLengths() #array('d', [11.0, 10.0])