
    e                         d Z ddlZddlZddlmZ  ej                  d        ej                           ej                         Z
e
j                  d       e
j                  d      Z ej                         aej!                  t                ej"                  d	d
gddg      at$        j'                  ddgddg       t$        j'                  ddgddg       ej!                  t$               t$        j)                  d        ej*                  dd      at,        j/                  t               t,        j)                  d        ej0                         Zej5                  t               e
j!                  e        ej6                  ddd      aej:                  j!                  t8               ej:                  j=                  d       t8        j?                  d       t8        j)                  d       e
jA                          e
j                  d      a!tB        jE                  d       e
jG                  dd       e
jI                          ejJ                  jM                  d      a'tN        ddddfxx   d z  cc<    ejP                  tN        d!      a'tN        ejJ                  jM                  d      d"z  z  a't        jS                  tN               ejU                  tN        jW                         tN        jY                                t,        j[                   ejP                  tN        d#              ej\                         Z/t        ja                  e/jc                  d$d$      je                  d%d             ejg                          d& Z4t$        jj                  jm                  e4        e4        d' Z7t8        jp                  jm                  e7       d( Z9e9t        _:        e;d)k(  r ejx                          yy)*z
Demonstrates common image analysis tools.

Many of the features demonstrated here are already provided by the ImageView
widget, but here we present a lower-level approach that provides finer control
over the user interface.
    N)QtGuiz	row-major)imageAxisOrderz!pyqtgraph example: Image Analysis )titlei         g      ?   
   g?g)levelpenT)anglemovabler   F)yi     )colspan   i   )   d   )size   P   g       @)   r   g?)r   r   g?ic                      t         j                  t        t              } t        j                  | j                  d      d       y )Nr   )axisT)clear)roigetArrayRegiondataimgp2plotmean)selecteds    B/usr/lib/python3/dist-packages/pyqtgraph/examples/imageAnalysis.py
updatePlotr'   P   s/    !!$,HGGHMMqM!G.    c                  R    t         j                  t        j                                y )N)isosetLevelisoLinevalue r(   r&   updateIsocurver/   X   s    LL!r(   c                 :   | j                         rt        j                  d       y| j                         }|j	                         |j                         }}t        t        j                  |dt        j                  d   dz
              }t        t        j                  |dt        j                  d   dz
              }t        ||f   }t        j                  |      }|j                         |j	                         }}t        j                  d|||||fz         y)z@Show the position, pixel, and value under the mouse cursor.
    r   Nr   r
   z1pos: (%0.1f, %0.1f)  pixel: (%d, %d)  value: %.3g)isExitp1setTitleposr   xintnpclipr    shaper!   mapToParent)eventr4   ijvalpposr5   r   s           r&   imageHoverEventr@   ^   s     ||~
B
))+C557CEEGqABGGAq$**Q-!+,-ABGGAq$**Q-!+,-A
q!t*C??3D668TVVXqAKKCq!QPQSVFWWXr(   __main__)=__doc__numpyr7   	pyqtgraphpgpyqtgraph.Qtr   setConfigOptionsmkQAppGraphicsLayoutWidgetwinsetWindowTitleaddPlotr2   	ImageItemr!   addItemROIr   addScaleHandle	setZValueIsocurveItemr*   setParentItemHistogramLUTItemhistsetImageItemInfiniteLiner,   vbsetMouseEnabledsetValuenextRowr"   setMaximumHeightresizeshowrandomnormalr    gaussianFiltersetImage	setLevelsminmaxsetData
QTransformtrsetTransformscale	translate	autoRanger'   sigRegionChangedconnectr/   
sigDraggedr@   
hoverEvent__name__execr.   r(   r&   <module>rs      s$        ; / 			b   6 7 	[[r[ blln 

3 bffb"X1v   C8c3Z (   As8c3Z ( 

3 b  booCS)   #  a  r   #  D  "//4S
9     %          $  [[[   C  

3  
 
yyZ( RUBrE\ b  rv& 		j)C/ / T  txxz488: & BdF+ , U   #s#--c15 6 /
     Z ( 
"     > *Y$ !zBGGI r(   