Exemplo n.º 1
0
    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()
Exemplo n.º 2
0
	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();
Exemplo n.º 3
0
	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();
Exemplo n.º 4
0
    def clearRoi(self):
        roi = RectangularROI()
        roiList = RectangularROIList()

        guibean = GuiBean()
        guibean[GuiParameters.ROIDATA] = roi
        guibean[GuiParameters.ROIDATALIST] = roiList

        RCPPlotter.setGuiBean(self.panel, guibean)

        self.updateRoiList()
Exemplo n.º 5
0
	def setPlotMode(self, plotmode=GuiPlotMode.TWOD):
#		guibean=GuiBean();
		guibean=RCPPlotter.getGuiBean(self.panel);
		guibean[GuiParameters.PLOTMODE]=plotmode;
		RCPPlotter.setGuiBean(self.panel, guibean);
Exemplo n.º 6
0
 def setPlotMode(self, plotmode=GuiPlotMode.TWOD):
     guibean = GuiBean()
     guibean[GuiParameters.ROIDATA] = plotmode
     RCPPlotter.setGuiBean(self.panel, guibean)
Exemplo n.º 7
0
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])
roidata.getAngle()  #0.0

#Set ROI
gpea = GuiBean()
newroi = RectangularROI(22, 33, 44, 55, 0)
gpea.put("ROIData", newroi)
#gpea["ROIData"] = newroi
pp.setGuiBean("Area Detector", gpea)

#For multiple ROIs:

gbean2 = pp.getGuiBean("Area Detector")
lb = gbean2.get(
    "ROIDataList"
)  # [Start (22.0000, 33.0000) Size (44.0000,55.0000) Angle 0.00000, Start (32.0000, 47.0000) Size (50.0000,17.0000) Angle 0.00000]
lb = gbean2[
    "ROIDataList"]  #[Start (22.0000, 33.0000) Size (44.0000,55.0000) Angle 0.00000, Start (32.0000, 47.0000) Size (50.0000,17.0000) Angle 0.00000]

len(gbean2)  #4

roi1 = gbean2["ROIDataList"][
    0]  #Start (22.0000, 33.0000) Size (44.0000,55.0000) Angle 0.00000
ro12 = gbean2["ROIDataList"][