select a box region on figure

09:26 / Comments (0) / by sswidl

Sometimes it is useful to choose a box region on a figure, e.g. to choose an interesting (normally a smaller) region to get XY coordinates for further analysis. In this case, you may try select_box.pro routine.

---- Module: select_box.pro
---- From: $SSW/gen/idl/display
---> Call: PRO SELECT_BOX,MX,MY,IX,IY,DATA=DATA,INIT=INIT,FIXED_SIZE=FIXED_SIZE

; Outputs :
; MX, MY = Size of selected box, in device coordinates.
; IX, IY = Coordinates of lower left-hand corner of selected box.
; Keywords :
; DATA = If this keyword is set, then the values are in returned in
; data coordinates instead of device coordinates.
;
; The following keywords are only relevant when used on a graphics device
; that supports windows:
;
; INIT = If this keyword is set, MX, MY, and IX, IY contain the
; initial parameters for the box.
;
; FIXED_SIZE = If this keyword is set, MX and MY contain the initial size
; of the box. This size may not be changed by the user.

; Operation is as follows:
; Left mouse button: Move the box by dragging.
; Middle mouse button: Resize the box by dragging. The corner
; nearest the initial mouse position is moved.
; Right mouse button: Exit this procedure, returning the
; current box parameters.

Example:

IDL> plot_image,dist(200,100)


IDL> select_box,MX,MY,IX,IY,/data


IDL> print,MX,MY,IX,IY
62.6728 39.1705 26.2269 40.7431

(Unit: pixel)

0 comments: