Changeset eba08f1a in sasview for guiframe/local_perspectives/plotting/boxSum.py
- Timestamp:
- Mar 3, 2009 2:12:26 PM (15 years ago)
- Branches:
- master, ESS_GUI, ESS_GUI_Docs, ESS_GUI_batch_fitting, ESS_GUI_bumps_abstraction, ESS_GUI_iss1116, ESS_GUI_iss879, ESS_GUI_iss959, ESS_GUI_opencl, ESS_GUI_ordering, ESS_GUI_sync_sascalc, costrafo411, magnetic_scatt, release-4.1.1, release-4.1.2, release-4.2.2, release_4.0.1, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
- Children:
- fe2ade9
- Parents:
- 18a3ee9
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
guiframe/local_perspectives/plotting/boxSum.py
r6d920cd reba08f1a 1 #TODO: the line slicer should listen to all 2DREFRESH events, get the data and slice it 2 # before pushing a new 1D data update. 3 4 # 5 #TODO: NEED MAJOR REFACTOR 6 # 7 8 9 # Debug printout 10 #from config import printEVT 1 2 3 4 import math 5 import wx 6 from copy import deepcopy 11 7 from BaseInteractor import _BaseInteractor 12 from copy import deepcopy13 import math14 15 #from Plotter1D import AddPlotEvent16 import SlicerParameters17 import wx18 19 8 from sans.guicomm.events import SlicerParamUpdateEvent,EVT_SLICER_PARS,StatusEvent 9 10 20 11 class BoxSum(_BaseInteractor): 21 12 """ 22 Select an annulus through a 2D plot 13 Boxsum Class: determine 2 rectangular area to compute the sum of pixel of 14 a Data. 15 Uses PointerInteractor , VerticalDoubleLine,HorizontalDoubleLine. 16 @param zorder: Artists with lower zorder values are drawn first. 17 @param x_min: the minimum value of the x coordinate 18 @param x_max: the maximum value of the x coordinate 19 @param y_min: the minimum value of the y coordinate 20 @param y_max: the maximum value of the y coordinate 21 23 22 """ 24 def __init__(self,base,axes,color='black', zorder=3, x_min=0.008, x_max=0.008, y_min=0.0025, y_max=0.0025): 23 def __init__(self,base,axes,color='black', zorder=3, x_min=0.008, 24 x_max=0.008, y_min=0.0025, y_max=0.0025): 25 25 26 26 _BaseInteractor.__init__(self, base, axes, color=color) 27 ## class initialization 28 ## list of Boxsmun markers 27 29 self.markers = [] 28 30 self.axes = axes 31 ## connect the artist for the motion 32 self.connect = self.base.connect 33 ## when qmax is reached the selected line is reset the its previous value 29 34 self.qmax = min(self.base.data2D.xmax, self.base.data2D.xmin) 30 self.connect = self.base.connect35 ## Define the boxsum limits 31 36 self.xmin= -1* 0.5*min(math.fabs(self.base.data2D.xmax),math.fabs( self.base.data2D.xmin)) 32 37 self.ymin= -1* 0.5*min(math.fabs(self.base.data2D.xmax),math.fabs( self.base.data2D.xmin)) 33 #self.xmax= x_max 34 #self.ymax= y_max 38 35 39 self.xmax= 0.5*min(math.fabs(self.base.data2D.xmax),math.fabs( self.base.data2D.xmin)) 36 40 self.ymax= 0.5*min(math.fabs(self.base.data2D.xmax),math.fabs( self.base.data2D.xmin)) 37 # center of the figure41 ## center of the boxSum 38 42 self.center_x= 0.0002 39 43 self.center_y= 0.0003 40 41 44 ## Number of points on the plot 42 45 self.nbins = 20 46 ## Define initial result the summation 43 47 self.count=0 44 48 self.error=0 49 ## Flag to determine if the current figure has moved 50 ## set to False == no motion , set to True== motion 45 51 self.has_move= False 46 47 self.horizontal_lines= Horizontal _DoubleLine(self, self.base.subplot,color='blue',52 ## Create Boxsum edges 53 self.horizontal_lines= HorizontalDoubleLine(self, self.base.subplot,color='blue', 48 54 zorder=zorder, 49 55 y= self.ymax, … … 53 59 self.horizontal_lines.qmax = self.qmax 54 60 55 self.vertical_lines= Vertical _DoubleLine(self, self.base.subplot,color='black',61 self.vertical_lines= VerticalDoubleLine(self, self.base.subplot,color='black', 56 62 zorder=zorder, 57 63 y= self.ymax, … … 60 66 center_y= self.center_y) 61 67 self.vertical_lines.qmax = self.qmax 68 62 69 self.center= PointInteractor(self, self.base.subplot,color='grey', 63 70 zorder=zorder, 64 71 center_x= self.center_x, 65 72 center_y= self.center_y) 66 67 68 #self.connect_markers([]) 69 self.panel_name="" 73 ## Save the name of the slicer panel associate with this slicer 74 self.panel_name="" 75 ## Update and post slicer parameters 70 76 self.update() 71 77 self._post_data() 72 73 # Bind to slice parameter events 74 #print "box sum self.base.parent",self.base.parent 78 ## Bind to slice parameter events 75 79 self.base.Bind(EVT_SLICER_PARS, self._onEVT_SLICER_PARS) 76 80 81 77 82 def set_panel_name(self, name): 83 """ 84 Store the name of the panel associated to this slicer 85 @param name: the name of this panel 86 """ 78 87 self.panel_name= name 79 88 80 89 81 90 def _onEVT_SLICER_PARS(self, event): 91 """ 92 receive an event containing parameters values to reset the slicer 93 @param event: event of type SlicerParameterEvent with params as 94 attribute 95 """ 96 ## Post e message to declare what kind of event has being received 82 97 wx.PostEvent(self.base.parent, StatusEvent(status="Boxsum._onEVT_SLICER_PARS")) 83 #print "receiving value ",event.params84 98 event.Skip() 99 ## reset the slicer with the values contains the event.params dictionary 85 100 if event.type == self.__class__.__name__: 86 101 self.set_params(event.params) 87 102 self.base.update() 88 103 89 def update_and_post(self):90 self.update()91 self._post_data()92 93 def save_data(self, path, image, x, y):94 output = open(path, 'w')95 96 data_x, data_y = self.get_data(image, x, y)97 98 output.write("<phi> <average>\n")99 for i in range(len(data_x)):100 output.write("%g %g\n" % (data_x[i], data_y[i]))101 output.close()102 104 103 105 def set_layer(self, n): 106 """ 107 Allow adding plot to the same panel 108 @param n: the number of layer 109 """ 104 110 self.layernum = n 105 111 self.update() 106 112 113 107 114 def clear(self): 115 """ 116 Clear the slicer and all connected events related to this slicer 117 """ 108 118 self.clear_markers() 109 119 self.horizontal_lines.clear() … … 111 121 self.center.clear() 112 122 self.base.connect.clearall() 113 #self.base.connect.disconnect()114 123 self.base.Unbind(EVT_SLICER_PARS) 115 124 125 116 126 def update(self): 117 127 """ 118 Respond to changes in the model by recalculating the profiles and 119 resetting the widgets. 120 """ 128 Respond to changes in the model by recalculating the profiles and 129 resetting the widgets. 130 """ 131 ## check if the center point has moved and update the figure accordingly 121 132 if self.center.has_move: 122 #print "center has move"123 133 self.center.update() 124 134 self.horizontal_lines.update( center= self.center) 125 135 self.vertical_lines.update( center= self.center) 126 136 ## check if the horizontal lines have moved and update the figure accordingly 127 137 if self.horizontal_lines.has_move: 128 #print "top has moved"129 138 self.horizontal_lines.update() 130 139 self.vertical_lines.update(y1=self.horizontal_lines.y1, 131 140 y2=self.horizontal_lines.y2, 132 141 height= self.horizontal_lines.half_height ) 142 ## check if the vertical lines have moved and update the figure accordingly 133 143 if self.vertical_lines.has_move: 134 #print "right has moved"135 144 self.vertical_lines.update() 136 145 self.horizontal_lines.update(x1=self.vertical_lines.x1, … … 150 159 151 160 def _post_data(self): 152 # Compute data 153 print 154 161 """ 162 Get the limits of the boxsum and compute the sum of the pixel 163 contained in that region and the error on that sum 164 """ 165 ## Data 2D for which the pixel will be summed 155 166 data = self.base.data2D 156 from DataLoader.manipulations import Boxavg 157 #radius = math.sqrt(math.pow(self.qmax,2)+math.pow(self.qmax,2)) 167 ## the region of the summation 158 168 x_min= self.horizontal_lines.x2 159 169 x_max= self.horizontal_lines.x1 160 170 y_min= self.vertical_lines.y2 161 171 y_max= self.vertical_lines.y1 162 #print "xmin, xmax, ymin , ymax", x_min, x_max, y_min, y_max 172 ##computation of the sum and its error 173 from DataLoader.manipulations import Boxavg 163 174 box = Boxavg (x_min=x_min, x_max=x_max, y_min=y_min, y_max=y_max) 164 175 self.count, self.error = box(self.base.data2D) 165 #print "box_sum output",box(self.base.data2D) 176 166 177 167 178 def moveend(self, ev): 179 """ 180 After a dragging motion this function is called to compute 181 the error and the sum of pixel of a given data 2D 182 """ 168 183 self.base.thaw_axes() 169 # Post paramters184 ## compute error an d sum of data's pixel 170 185 self._post_data() 171 186 ## Create and event ( posted to guiframe)that set the 187 ##current slicer parameter to a panel of name self.panel_name 172 188 self.type= self.__class__.__name__ 173 189 params= self.get_params() … … 184 200 self.vertical_lines.restore() 185 201 self.center.restore() 202 203 186 204 def move(self, x, y, ev): 187 205 """ … … 189 207 """ 190 208 pass 209 191 210 192 211 def set_cursor(self, x, y): 193 212 pass 194 213 214 195 215 def get_params(self): 216 """ 217 Store a copy of values of parameters of the slicer into a dictionary. 218 @return params: the dictionary created 219 """ 196 220 params = {} 197 198 221 params["Width"] = math.fabs(self.vertical_lines.half_width)*2 199 222 params["Height"] = math.fabs(self.horizontal_lines.half_height)*2 200 201 223 params["center_x"] = self.center.x 202 224 params["center_y"] =self.center.y 203 225 params["count"] = self.count 204 226 params["errors"]= self.error 205 206 227 return params 207 228 … … 218 239 219 240 def set_params(self, params): 220 241 """ 242 Receive a dictionary and reset the slicer with values contained 243 in the values of the dictionary. 244 @param params: a dictionary containing name of slicer parameters and 245 values the user assigned to the slicer. 246 """ 221 247 x_max = math.fabs(params["Width"] )/2 222 248 y_max = math.fabs(params["Height"] )/2 … … 224 250 self.center_x=params["center_x"] 225 251 self.center_y=params["center_y"] 226 252 #update the slicer given values of params 227 253 self.center.update(center_x=self.center_x,center_y=self.center_y) 228 229 254 self.horizontal_lines.update(center= self.center, 230 255 width=x_max, … … 233 258 width=x_max, 234 259 height=y_max) 235 260 #compute the new error and sum given values of params 236 261 self._post_data() 237 262 … … 241 266 self.base.freeze_axes() 242 267 268 243 269 def thaw_axes(self): 244 270 self.base.thaw_axes() 245 271 272 246 273 def draw(self): 247 274 self.base.draw() 275 276 277 248 278 class PointInteractor(_BaseInteractor): 249 279 """ 250 Select an annulus through a 2D plot 280 Draw a point that can be dragged with the marker. 281 this class controls the motion the center of the BoxSum 251 282 """ 252 283 def __init__(self,base,axes,color='black', zorder=5, … … 255 286 256 287 _BaseInteractor.__init__(self, base, axes, color=color) 288 ## Initialization the class 257 289 self.markers = [] 258 290 self.axes = axes 259 # center 291 # center coordinates 260 292 self.x = center_x 261 293 self.y = center_y 262 294 ## saved value of the center coordinates 263 295 self.save_x = center_x 264 296 self.save_y = center_y 265 266 297 ## Create a marker 267 298 try: 268 299 self.center_marker = self.axes.plot([self.x],[self.y], linestyle='', … … 280 311 message = "\nTHIS PROTOTYPE NEEDS THE LATEST VERSION OF MATPLOTLIB\n" 281 312 message += "Get the SVN version that is at least as recent as June 1, 2007" 282 283 #raise "Version error", message284 285 # line313 owner=self.base.base.parent 314 wx.PostEvent(owner, StatusEvent(status="AnnulusSlicer: %s"%message)) 315 316 ## Draw a point 286 317 self.center = self.axes.plot([self.x],[self.y], 287 318 linestyle='-', marker='', 288 319 color=self.color, 289 320 visible=True)[0] 290 291 self. npts = 30292 self.has_move=False321 ## Flag to determine the motion this point 322 self.has_move=False 323 ## connecting the marker to allow them to move 293 324 self.connect_markers([self.center_marker]) 294 self.update() 325 ## Update the figure 326 self.update() 327 295 328 296 329 def set_layer(self, n): 330 """ 331 Allow adding plot to the same panel 332 @param n: the number of layer 333 """ 297 334 self.layernum = n 298 335 self.update() 299 336 337 300 338 def clear(self): 339 """ 340 Clear this figure and its markers 341 """ 301 342 self.clear_markers() 302 343 try: … … 307 348 for item in range(len(self.axes.lines)): 308 349 del self.axes.lines[0] 309 310 def get_radius(self): 311 312 return 0 350 313 351 314 352 def update(self, center_x=None,center_y=None): 315 353 """ 316 Draw the new roughness on the graph.354 Draw the new roughness on the graph. 317 355 """ 318 356 if center_x !=None: self.x= center_x … … 323 361 324 362 325 326 327 363 def save(self, ev): 328 364 """ … … 332 368 self.save_x= self.x 333 369 self.save_y= self.y 334 335 370 self.base.freeze_axes() 371 336 372 337 373 def moveend(self, ev): … … 346 382 self.y= self.save_y 347 383 self.x= self.save_x 384 348 385 349 386 def move(self, x, y, ev): … … 357 394 self.base.base.update() 358 395 396 359 397 def set_cursor(self, x, y): 360 398 self.move(x, y, None) … … 366 404 params["x"] = self.x 367 405 params["y"] = self.y 368 369 406 return params 407 370 408 371 409 def set_params(self, params): … … 375 413 376 414 377 class Vertical _DoubleLine(_BaseInteractor):415 class VerticalDoubleLine(_BaseInteractor): 378 416 """ 379 Select an annulus through a 2D plot 417 Draw 2 vertical lines moving in opposite direction and centered on 418 a point (PointInteractor) 380 419 """ 381 420 def __init__(self,base,axes,color='black', zorder=5, x=0.5,y=0.5, … … 384 423 385 424 _BaseInteractor.__init__(self, base, axes, color=color) 425 ## Initialization the class 386 426 self.markers = [] 387 427 self.axes = axes 388 # center428 ## Center coordinates 389 429 self.center_x = center_x 390 430 self.center_y = center_y 391 392 393 431 ## defined end points vertical lignes and their saved values 394 432 self.y1 = y + self.center_y 395 433 self.save_y1= self.y1 … … 405 443 self.x2= self.center_x - delta 406 444 self.save_x2 = self.x2 407 408 self.color =color409 445 ## save the color of the line 446 self.color = color 447 ## the height of the rectangle 410 448 self.half_height= math.fabs(y) 411 449 self.save_half_height= math.fabs(y) 412 450 ## the with of the rectangle 413 451 self.half_width= math.fabs(self.x1- self.x2)/2 414 452 self.save_half_width=math.fabs(self.x1- self.x2)/2 415 453 ## Create marker 416 454 try: 417 455 self.right_marker = self.axes.plot([self.x1],[0], linestyle='', … … 429 467 message = "\nTHIS PROTOTYPE NEEDS THE LATEST VERSION OF MATPLOTLIB\n" 430 468 message += "Get the SVN version that is at least as recent as June 1, 2007" 431 432 #raise "Version error", message433 434 # line469 owner=self.base.base.parent 470 wx.PostEvent(owner, StatusEvent(status="AnnulusSlicer: %s"%message)) 471 472 ## define the left and right lines of the rectangle 435 473 self.right_line = self.axes.plot([self.x1,self.x1],[self.y1,self.y2], 436 474 linestyle='-', marker='', … … 441 479 color=self.color, 442 480 visible=True)[0] 443 444 self. npts = 30445 self.has_move=False481 ## Flag to determine if the lines have moved 482 self.has_move=False 483 ## connection the marker and draw the pictures 446 484 self.connect_markers([self.right_marker]) 447 485 self.update() … … 449 487 450 488 def set_layer(self, n): 489 """ 490 Allow adding plot to the same panel 491 @param n: the number of layer 492 """ 451 493 self.layernum = n 452 494 self.update() 453 495 496 454 497 def clear(self): 498 """ 499 Clear this figure and its markers 500 """ 455 501 self.clear_markers() 456 502 try: … … 462 508 for item in range(len(self.axes.lines)): 463 509 del self.axes.lines[0] 464 465 def get_radius(self): 466 467 return 0 510 468 511 469 512 def update(self,x1=None,x2=None, y1=None,y2=None,width=None, height=None, center=None): 470 513 """ 471 Draw the new roughness on the graph. 472 """ 473 #print "self.half_height",self.half_height,self.half_width 514 Draw the new roughness on the graph. 515 @param x1: new maximum value of x coordinates 516 @param x2: new minimum value of x coordinates 517 @param y1: new maximum value of y coordinates 518 @param y2: new minimum value of y coordinates 519 @param width: is the width of the new rectangle 520 @param height: is the height of the new rectangle 521 @param center: provided x, y coordinates of the center point 522 """ 523 ## save the new height, witdh of the rectangle if given as a param 474 524 if width!=None: 475 525 self.half_width= width 476 526 if height!=None: 477 527 self.half_height= height 528 ## If new center coordinates are given draw the rectangle 529 ##given these value 478 530 if center!=None: 479 531 self.center_x= center.x 480 532 self.center_y= center.y 481 #print "vertical width",self.half_width ,self.center_x533 482 534 self.x1 = self.half_width + self.center_x 483 535 self.x2= -self.half_width + self.center_x … … 490 542 self.left_line.set(xdata=[self.x2,self.x2], ydata=[self.y1,self.y2]) 491 543 return 544 ## if x1, y1, y2, y3 are given draw the rectangle with this value 492 545 if x1 !=None: 493 546 self.x1= x1 … … 498 551 if y2 !=None: 499 552 self.y2= y2 500 501 502 553 ## Draw 2 vertical lines and a marker 503 554 self.right_marker.set(xdata=[self.x1],ydata=[self.center_y]) 504 555 self.right_line.set(xdata=[self.x1,self.x1], ydata=[self.y1,self.y2]) … … 518 569 519 570 self.save_half_height= self.half_height 520 #self.save_half_width = math.fabs(self.x1-self.x2)/2521 571 self.save_half_width = self.half_width 572 522 573 self.base.freeze_axes() 523 574 575 524 576 def moveend(self, ev): 525 577 """ 578 After a dragging motion reset the flag self.has_move to False 579 """ 526 580 self.has_move=False 527 581 self.base.moveend(ev) 528 582 583 529 584 def restore(self): 530 585 """ … … 538 593 539 594 self.half_height= self.save_half_height 540 #self.half_width= math.fabs(self.x1-self.x2)/2541 595 self.half_width= self.save_half_width 596 542 597 543 598 def move(self, x, y, ev): … … 550 605 551 606 self.half_width= math.fabs(self.x1-self.x2)/2 552 #print "Move vert: vertical width",self.half_width ,self.center_x607 553 608 self.has_move=True 554 609 self.base.base.update() 555 610 611 556 612 def set_cursor(self, x, y): 613 """ 614 Update the figure given x and y 615 """ 557 616 self.move(x, y, None) 558 617 self.update() … … 560 619 561 620 def get_params(self): 621 """ 622 Store a copy of values of parameters of the slicer into a dictionary. 623 @return params: the dictionary created 624 """ 562 625 params = {} 563 626 params["x"] = self.x1 … … 567 630 568 631 def set_params(self, params): 632 """ 633 Receive a dictionary and reset the slicer with values contained 634 in the values of the dictionary. 635 @param params: a dictionary containing name of slicer parameters and 636 values the user assigned to the slicer. 637 """ 569 638 x = params["x"] 570 639 y = params["y"] 571 640 self.update(x=x, y=y, center_x=None,center_y=None) 572 641 573 class Horizontal_DoubleLine(_BaseInteractor): 642 643 class HorizontalDoubleLine(_BaseInteractor): 574 644 """ 575 645 Select an annulus through a 2D plot … … 580 650 581 651 _BaseInteractor.__init__(self, base, axes, color=color) 652 ## Initialization the class 582 653 self.markers = [] 583 654 self.axes = axes 584 # center655 ## Center coordinates 585 656 self.center_x = center_x 586 657 self.center_y = center_y … … 623 694 message = "\nTHIS PROTOTYPE NEEDS THE LATEST VERSION OF MATPLOTLIB\n" 624 695 message += "Get the SVN version that is at least as recent as June 1, 2007" 625 626 #raise "Version error", message627 628 # line696 owner=self.base.base.parent 697 wx.PostEvent(owner, StatusEvent(status="AnnulusSlicer: %s"%message)) 698 699 # Define 2 horizotnal lines 629 700 self.top_line = self.axes.plot([self.x1,-self.x1],[self.y1,self.y1], 630 701 linestyle='-', marker='', … … 635 706 color=self.color, 636 707 visible=True)[0] 637 638 self.npts = 30 708 ## Flag to determine if the lines have moved 639 709 self.has_move=False 710 ## connection the marker and draw the pictures 640 711 self.connect_markers([self.top_marker]) 641 712 self.update() … … 643 714 644 715 def set_layer(self, n): 716 """ 717 Allow adding plot to the same panel 718 @param n: the number of layer 719 """ 645 720 self.layernum = n 646 721 self.update() 647 722 723 648 724 def clear(self): 725 """ 726 Clear this figure and its markers 727 """ 649 728 self.clear_markers() 650 729 try: … … 656 735 for item in range(len(self.axes.lines)): 657 736 del self.axes.lines[0] 658 659 def get_radius(self): 660 661 return 0 737 662 738 663 739 def update(self,x1=None,x2=None, y1=None,y2=None,width=None,height=None, center=None): 664 740 """ 665 Draw the new roughness on the graph. 666 """ 667 #print "self.half_width",self.half_width 668 if width!=None: 669 self.half_width= width 670 if height!=None: 741 Draw the new roughness on the graph. 742 @param x1: new maximum value of x coordinates 743 @param x2: new minimum value of x coordinates 744 @param y1: new maximum value of y coordinates 745 @param y2: new minimum value of y coordinates 746 @param width: is the width of the new rectangle 747 @param height: is the height of the new rectangle 748 @param center: provided x, y coordinates of the center point 749 """ 750 ## save the new height, witdh of the rectangle if given as a param 751 if width != None: 752 self.half_width = width 753 if height!= None: 671 754 self.half_height= height 755 ## If new center coordinates are given draw the rectangle 756 ##given these value 672 757 if center!=None: 673 758 self.center_x= center.x … … 684 769 self.bottom_line.set(xdata=[self.x1,self.x2], ydata=[self.y2,self.y2]) 685 770 return 771 ## if x1, y1, y2, y3 are given draw the rectangle with this value 686 772 if x1 !=None: 687 773 self.x1= x1 … … 692 778 if y2 !=None: 693 779 self.y2= y2 694 695 780 ## Draw 2 vertical lines and a marker 696 781 self.top_marker.set(xdata=[self.center_x],ydata=[self.y1]) 697 782 self.top_line.set(xdata=[self.x1,self.x2], ydata=[self.y1,self.y1]) … … 699 784 700 785 701 702 786 def save(self, ev): 703 787 """ … … 717 801 718 802 def moveend(self, ev): 719 803 """ 804 After a dragging motion reset the flag self.has_move to False 805 """ 720 806 self.has_move=False 721 807 self.base.moveend(ev) 808 722 809 723 810 def restore(self): … … 732 819 self.half_height= self.save_half_height 733 820 self.half_width= self.save_half_width 821 734 822 735 823 def move(self, x, y, ev): … … 744 832 self.base.base.update() 745 833 834 746 835 def set_cursor(self, x, y): 836 """ 837 Update the figure given x and y 838 """ 747 839 self.move(x, y, None) 748 840 self.update() … … 750 842 751 843 def get_params(self): 844 """ 845 Store a copy of values of parameters of the slicer into a dictionary. 846 @return params: the dictionary created 847 """ 752 848 params = {} 753 849 params["x"] = self.x 754 850 params["y"] = self.y 755 756 851 return params 757 852 853 758 854 def set_params(self, params): 855 """ 856 Receive a dictionary and reset the slicer with values contained 857 in the values of the dictionary. 858 @param params: a dictionary containing name of slicer parameters and 859 values the user assigned to the slicer. 860 """ 759 861 x = params["x"] 760 862 y = params["y"] 761 863 self.update(x=x, y=y, center_x=None,center_y=None) 762 864 865 866
Note: See TracChangeset
for help on using the changeset viewer.