;ijdZddlZddlmZddlmZddlZddlm Z ddlm Z ddlm Z dd l mZdd lmZdd lmZdd lmZdd lmZddlmZddlmZddlmZmZmZddlmZddlm Z! ddl"m#Z#m$Z$n#e%$r ddlm#Z#m$Z$YnwxYwej&j'Z'GddeZ(Gddej)Z*dS)a ImageView.py - Widget for basic image dispay and analysis Copyright 2010 Luke Campagnola Distributed under MIT/X11 license. See license.txt for more information. Widget used for displaying 2D or 3D data. Features: - float or int (including 16-bit int) image display via ImageItem - zoom/pan via GraphicsView - black/white level controls - time slider for 3D data sets - ROI plotting - Image normalization through a variety of methods N)log10) perf_counter)debug) functions)getConfigOption)addGradientListToDocstring) ImageItem) InfiniteLine)LinearRegionItem)ROI)ViewBox) VTickGroup)QtCoreQtGui QtWidgets) SignalProxy)ImageViewTemplate_generic)nanmaxnanminceZdZdZdS)PlotROIctj|ddg||ddgddg|ddgddgdS)Nr)possizer?)r __init__addScaleHandleaddRotateHandle)selfrs QC:\PYTHON\MyICR_Workspace\venv\Lib\site-packages\pyqtgraph/imageview/ImageView.pyrzPlotROI.__init__+s_ T!u40000 QFQF+++ aVc3Z00000N)__name__ __module__ __qualname__rr#r"rr*s#11111r#rceZdZdZejeeZejeZ d-dZ d.dZ dZ d/d Z d Z d/d Zd Zd ZdZdZdZfdZfdZfdZdZdZdZdZdZdZdZdZdZdZ dZ!dZ"d Z#d0d!Z$d"Z%d#Z&d$Z'd%Z(d&Z)d'Z*d(Z+d)Z,d*Z-d+Z.e/d,Z0xZ1S)1 ImageViewa Widget used for display and analysis of image data. Implements many features: * Displays 2D and 3D image data. For 3D data, a z-axis slider is displayed allowing the user to select which frame is displayed. * Displays histogram of image data with movable region defining the dark/light levels * Editable gradient provides a color lookup table * Frame slider may also be moved using left/right arrow keys as well as pgup, pgdn, home, and end. * Basic analysis features including: * ROI and embedded plot for measuring image values across frames * Image normalization / background subtraction Basic Usage:: imv = pg.ImageView() imv.show() imv.setImage(data) **Keyboard interaction** * left/right arrows step forward/backward 1 frame when pressed, seek at 20fps when held. * up/down arrows seek at 100fps * pgup/pgdn seek at 1000fps * home/end seek immediately to the first/last frame * space begins playing frames. If time values (in seconds) are given for each frame, then playback is in realtime. NmonoFc tjj||g| Rd|_d|_d|_||_d|_i|_d|_ tj |_ |j ||j j|_||_|j j|d|_|t)|_n||_|j j|j|jd|jd|_|j j|t9d|_n||_|jd|j|j|j|/t9d|_ |j !dn||_ |j d|j|j |j g|_"tGdd|_$tKd d kr|j$!d n|j$!d |j$d |j j&|j$|j j'(|)dz dg|tU|_+n7||_+|,|jdd|-|j|j+d|_.|j j/|j+|j j||j j'} | 0d 1d| 2d| 3d|j j&4dtkdd gd|_6|j j&|j6di|_7tqj9|_:d|_;d|_<d |_=d|_>t|_@|j@d|j j&|j@|j@dD]&} t|| t|j| 'dD]+} t|| t|j j| ,|j$jCD|jE|j jFjGD|jH|jjID|jJ|j jKjGD|jL|j jMjGD|jN|j jOjGD|jN|j jPjGD|jN|j jQjGD|jR|j jSjGD|jR|j jTjGD|jR|j:jUD|jUt|j@jI|jRd|_W|j jXD|jR|j j&Y|jdz|jZ|jtpj[j\j]tpj[j\j^tpj[j\j_tpj[j\j`tpj[j\jatpj[j\jbg|_c|HdS)a By default, this class creates an :class:`ImageItem ` to display image data and a :class:`ViewBox ` to contain the ImageItem. Parameters ---------- parent : QWidget Specifies the parent widget to which this ImageView will belong. If None, then the ImageView is created with no parent. name : str The name used to register both the internal ViewBox and the PlotItem used to display ROI data. See the *name* argument to :func:`ViewBox.__init__() `. view : ViewBox or PlotItem If specified, this will be used as the display area that contains the displayed image. Any :class:`ViewBox `, :class:`PlotItem `, or other compatible object is acceptable. Note: to display axis ticks inside the ImageView, instantiate it with a PlotItem instance as its view:: pg.ImageView(view=pg.PlotItem()) imageItem : ImageItem If specified, this object will be used to display the image. Must be an instance of ImageItem or other compatible object. levelMode : str See the *levelMode* argument to :func:`HistogramLUTItem.__init__() ` discreteTimeLine : bool Whether to snap to xvals / frame numbers when interacting with the timeline position. roi : ROI If specified, this object is used as ROI for the plot feature. Must be an instance of ROI. normRoi : ROI If specified, this object is used as ROI for the normalization feature. Must be an instance of ROI. NFT yr)movable backgroundw)r-Pr2)r4rr3r#) autoRange autoLevels transformz)QSplitter::handle{background-color: grey}rleftg?皙?)yrangepen) ignoreBounds)addItem removeItem)setHistogramRangeautoHistogramRangegetLookupTable getLevels)slot threadSafe_ROI)drQWidgetr _imageLevelslevelMinlevelMaxnameimageaxes imageDisp ui_templateUi_FormuisetupUi graphicsViewscenediscreteTimeLine histogram setLevelModeignoreTimeLinerviewsetCentralItemsetAspectLockedinvertYmenu normGrouphiderroi setZValuer>normRoisetPen roiCurvesr timeLinerroiPlotsplittersetSizesheightr imageItemsetImager8 currentIndex setImageItemhandle setEnabled setStyleSheetsetHandleWidthhideAxisr frameTicks keysPressedrQTimer playTimerplayRate_pausedPlayRatefps lastPlayTimer normRgnsetattrgetattrsigPositionChangedconnecttimeLineChangedroiBtnclicked roiClickedsigRegionChanged roiChangedmenuBtn menuClickednormDivideRadionormRadioChangednormSubtractRadio normOffRadio normROICheck updateNormnormFrameChecknormTimeRangeChecktimeoutr normProxysigRegionChangeFinished registerPlotregisterQtKey Key_RightKey_LeftKey_UpKey_Down Key_PageUp Key_PageDown noRepeatKeys) r!parentrKrYrj levelModerUr`rbargssfns r"rzImageView.__init__SsV "47$7777      %'' W)//11 0 &&y111# < DIIDI ++DI666 !!$'''      ;r{{DHHDH 2 $(###   ?"2;;DL L   $ $ $ $"DL r""" $,''' $Q555 < ( (# - - M !1 2 2 2 2 M !3 4 4 4 """  ... !!4;;==#3R"8999  &[[DNN&DN MM)/UuXaXkXkXmXmM n n n $.))) &&t~666 &&y111 G   u%%% CDDD    ((($S!H#>>> dCCC #'))  q!!!  --- , 6 6B D"gdi44 5 5 5 5] > >B D"gdg&7<< = = = = (001EFFF &&t777 !))$/::: ''(8999 '//0EFFF !)11$2GHHH $,,T-BCCC $,,T_=== &..t??? "*224?CCC &&t|444$ L )    ,44T_EEE $$TY%7888 49%%% IM # IM " IM IM " IM $ IM &   r#Tc , tj} tdr)drt t js>gd} tfd| Dstdt| z|_ d|_ | |j j| | ||jjdkrdnd \}}jd krd||dd |_n.jd kr2jd d krd||d d |_nd|dz|dzdd |_njd krd|dz|dzd d |_nt+dtjzt |t,r||_nt |t0st |t2r7i|_t5t7|D]}||j||<nt+dt|zd D]%}|j|d|j|<&|j}|||_n|dtdrS |d|_n[#t jj|d|_Yn-xYwt jj|d|_| d|_ |!| ||r|"| |j#||j j$%r|&| |jdc|j j'(|j)|j*|j+,|j|j-.dt7|jdkr_|j)}|j*t_|jd|jdz dzz}n=t7|jdkr!|jddz }|jddz}nd}d}|j-|j0fD]}|1||g| | +tej3} | | j4|| | j5||j6| | |r|7|8| dS)a Set the image to be displayed in the widget. Parameters ---------- img : np.ndarray The image to be displayed. See :func:`ImageItem.setImage` and *notes* below. autoRange : bool Whether to scale/pan the view to fit the image. autoLevels : bool Whether to update the white/black levels to fit the image. levels : tuple (min, max) white and black level values to use. axes : dict Dictionary indicating the interpretation for each axis. This is only needed to override the default guess. Format is:: {'t':0, 'x':1, 'y':2, 'c':3}; xvals : np.ndarray 1D array of values corresponding to the first axis in a 3D image. For video, this array should contain the time of each frame. pos Change the position of the displayed image scale Change the scale of the displayed image transform Set the transform of the displayed image. This option overrides *pos* and *scale*. autoHistogramRange : bool If True, the histogram y-range is automatically scaled to fit the image data. levelMode : str If specified, this sets the user interaction mode for setting image levels. Options are 'mono', which provides a single level control for all image channels, and 'rgb' or 'rgba', which provide individual controls for each channel. Notes ----- For backward compatibility, image data is assumed to be in column-major order (column, row). However, most image data is stored in row-major order (row, column) and will need to be transposed before calling setImage():: imageview.setImage(imagedata.T) This requirement can be changed by the ``imageAxisOrder`` :ref:`global configuration option `. implements MetaArray)dtypemaxminndimshaperc38K|]}t|VdSN)hasattr).0attrimgs r" z%ImageView.setImage..As-??dwsD))??????r#zYImage must be NumPy array or any object that provides compatible attributes/methods: %sN col-major)rr)rrrtxr.crrz*Can not interpret image with dimensions %szfCan not interpret axis specification %s. Must be like {'t': 2, 'x': 0, 'y': 1} or ('t', 'x', 'y', 'c')rxvals)rAg{Gz?r)9rProfilerrrasarray isinstancenpndarrayall TypeErrorstrrLrNrQrVrWrj axisOrderrrMr ExceptiondictcopylisttuplerangelengettValsrarangerl updateImager7 setLevelsr isCheckedrrf setXRangerrrssetXValsresetValueabsr{ setBoundsr QTransform translatescale setTransformr6r)r!rr6r7levelsrMrrrr8rArprofilerrequiredrr.istartstoprs ` r"rkzImageView.setImagesv>## 3 % % #..*E*E ++--C#rz** 8GGGH????h????? 8!'),X!7888   G  * *9 5 5 5 < N4 CC&&CAax1}}"&QQTBB Q9Q<1$$&* C CDII&'ac!$ G GDIIQ"#!A#AaCa@@  LPSTWT]P^P^ _``` d # # T DII d # # Tz$'>'> TDI3t99%% ' '%& $q'"" 'EILMQIRIRSTT T% 2 2A9==D11DIaLLy  DJJ #Y "sG$$ =A!$49!5!5DJJA!#39T#Y+?!@!@DJJJYsyc';<<   ,>??? >j> OO      DNF # # 7> # # % %  OO    9S> % GO % %djnn&6&6 8H8H I I I O $ $TZ 0 0 0 M " "1 % % %4:"" ((z~~''#djntz!}.L*M*MPT*TTTZA%% 1 +z!}s*mT\2 + + UDM****  (**I# #S))  '' ##I...   NN     s  J22,K cFd|_|jdSr)rLrjclearr!s r"rzImageView.clears#  r#cv||jp|j}|dkr|jdvr |j|_||_|dkr|jdSt |_|js9|jttd|z dSdS)zBegin automatically stepping frames forward at the given rate (in fps). This can also be accessed by pressing the spacebar.NrNr) rxryrwrvrrrzisActiverrint)r!rates r"playzImageView.plays <'348D 199i77#'=D  199 N   ! ! ! F(NN~&&(( 6 N Sd^^!4!4 5 5 5 5 5 6 6r#cb|jr|ddS|jdkrY|j|j}n3|dz |jd|jdz z }||dS||jdS)Nrrr)rvrrrwrxnframesr)r!rys r" togglePausezImageView.togglePauses > " " $ $ % IIaLLLLL ]a  #/*||~~)djntz!}.LM IIcNNNNN IIdm $ $ $ $ $r#c |jjj}|j|fi||dkr|d|jjddS)z Set the label text of the histogram axis similar to :func:`AxisItem.setLabel() ` FN)rQrVaxissetLabel showLabelsetMinimumWidth)r!textkwargsas r"setHistogramLabelzImageView.setHistogramLabelse G  " 4""6""" 2:: KK    ))#.....r#cl|jdS|jd|jj|jdSdS)zi Returns ------- int The number of frames in the image data. Nrrr)rLrMrrs r"rzImageView.nframess8 : 1 Ys^ ':#DIcN3 3qr#c<||jdS)zGSet the min/max intensity levels automatically to match the image data.)rgbaN)rrHrs r"r7zImageView.autoLevelss D-.....r#c4|jjj|i|dS)zSet the min/max (bright and dark) levels. See :func:`HistogramLUTItem.setLevels `. N)rQrVr)r!rkwdss r"rzImageView.setLevelss' $#T2T22222r#c`||jdS)zPAuto scale and pan the view around the image such that the image fills the view.N)getProcessedImagerYr6rs r"r6zImageView.autoRanges.     r#c*|j||j}||_||j|_t d|jD|_td|jD|_|jS)z`Returns the image data after it has been processed by any normalization options in use. Ncg|] }|d S)rr'rlevels r" z/ImageView.getProcessedImage.. I I Ieq I I Ir#cg|] }|d Srr'rs r"rz/ImageView.getProcessedImage..rr#) rN normalizerL quickMinMaxrHrrIrrJ)r!rLs r"rzImageView.getProcessedImages > !NN4:..E"DN $ 0 0 @ @D  I It7H I I IJJDM I It7H I I IJJDM~r#c|d|_|jdt t ||ddS)zUCloses the widget nicely, making sure to clear the graphics scene and release memory.N)rrNrj setParentsuperr)close)r! __class__s r"r zImageView.closesa    &&& i$$&&& tr#c,|s#t|dS|tjjjkr*|| dS|tjjj kr@| d| d| dS|tjjj krU| |dz | d| dS||jvr\| |rdSd|j|<|dSt|dS)Nrr) hasTimeAxisr  keyPressEventkeyrrr Key_SpaceracceptKey_HomesetCurrentIndexrKey_Endrr isAutoRepeatrt evalKeyStater!evr s r"rzImageView.keyPressEvents!!  GG ! !" % % % F 6688vy}. . .       IIKKKKK VVXX/ / /   # # # IIaLLL IIKKKKK VVXX. . .  !1 2 2 2 IIaLLL IIKKKKK VVXX* * * IIKKK   )*D RVVXX &         GG ! !" % % % % %r#c|s#t|dS|tjjjtjjjtjjj fvr| dS||j vrj| | rdS |j |=n#i|_ YnxYw|dSt|dSr)rr keyReleaseEventrrrrrrrrrrrtrrs r"rzImageView.keyReleaseEvents!!  GG # #B ' ' ' F 6688 /1GI^_ _ _ IIKKKKK VVXX* * * IIKKK    &$RVVXX.. &#%           GG # #B ' ' ' ' 's *D Dct|jdkrt|jd}|tjjjkrB|d| dtdz|_ dS|tjjj krB|d| dtdz|_ dS|tjjj kr|ddS|tjjjkr|ddS|tjjjkr|d dS|tjjjkr|d dSdS|ddS) Nrrr-g?iridir)rrtrkeysrrrrr jumpFramesrrzrrrrr)r!rs r"rzImageView.evalKeyState0s t A % %t',,..//2Cfim--- " """$0NNS$8!!! ... ####$0NNS$8!!! ,,, $ ... # 000 %      222 $32 IIaLLLLLr#ctt}||jz }|dkrdSt|j|z}|dkrz|xjt ||jz z c_|j|z|jj|jdkr| d| |dSdS)Nrr) rrzrrwfloatrlrLrrMrr )r!nowdtns r"rzImageView.timeoutGsnn 4$ $ 66 F  " # # 66   %((4="8 9   "TZ%5din%EEE ! OOA      6r#ctj|d|dz }||_|d|_|j|j|d|_dS)z(Set the currently displayed frame index.rrTFN) r clip_scalarrrlrrXrerr)r!indindexs r"rzImageView.setCurrentIndexSsosAt||~~a'788! " tz%0111#r#c^|jd||j|zdSdS)z1Move video frame ahead n frames (may be negative)rN)rMrrl)r!r%s r"r zImageView.jumpFrames]s8 9S> %  !2Q!6 7 7 7 7 7 & %r#cd|_||||j|dSr)rNrr7rsigProcessingChangedemitrs r"rzImageView.normRadioChangedbsX    !&&t,,,,,r#cD|jjr|jn|j|jjr|jn|j|jjs_d|_ | | | |j |dSdSr)rQrrr{showr_rrbrrNrr7rr,r-rs r"rzImageView.updateNormis 7 % / / 1 1 L       L      7  ) ) + + L       L     w#--// 1!DN       OO    OO     % * *4 0 0 0 0 0  1 1r#c$|jj||j|o|jj|j|o|jjdSr)rQr^ setVisiblerbrrr{r)r!bs r" normToggledzImageView.normToggled{sy $$Q'''  Fdg&:&D&D&F&FGGG  Ldg&@&J&J&L&LMMMMMr#c2d|jvo|jdduS)NrrMrs r"rzImageView.hasTimeAxissdi>DIcN$$>>r#c:d}|jjr$d}|j|jjdd|jjt| dzt| dzg|jj d d| |jD]}||jjdnv|j|jjdd|jD]}||jjd|rd}|j}|j}|jj||d|j|j||g|jjsh|jj| d z d g|jj d dn|j|jj|dS) NFTg333333?r:rr9g{Gz?)paddingr5)rQrrr`r/rfsetMouseEnabledrgrhrrirnrorrdshowAxisr_rrrrrrrrerr1)r! showRoiPlotrmnmxs r"rzImageView.roiClickeds 7> # # % % -K HMMOOO GO + +D$ 7 7 7 G  % %s4;;==+<'='=s4;;==QTCT?U?U&V W W W G  # #A & & 1 1$ 7 7 7 OO   ^   GO $ $V , , , , HMMOOO GO + +E5 9 9 9^   GO $ $V , , ,      !K!!B!!B GO % %b"d % ; ; ; M   M # #RH - - -7>++-- = ))4;;==+;R*@AAA ''**55e<<< M    "";/////r#cT|jdS|}|jjdk}|r|jd|jdf}n|jd|jdf}|j|tj |j|d\}}|dS|jd| |jd}|r |dddddf|dddd dfz }n|dddddf|ddddd fz }|d z dd z}n| |}|j }|j d kr||d fg}|j d kr_|jd d krd }nd }g}t|jd D],} |dd| f} ||| || f-t#|t#|jkre|j} | | t#|t#|jket#|t#|jkr[|j|jjt#|t#|jk[tt#|D]1} || \} } }|j| | | |2dS)Nrrr.T)rrMreturnMappedCoordsrrrrrrr1rgbw)r<)rLrrjrrMr`getArrayRegionrYrrmeansumrrrrappendrrdpoprTr?rQrfplotsetData)r!rLcolmajrMdatacoordsrplotscolorsrdrrr.ps r"rzImageView.roiChangeds3 :  F&&(( )[8  4IcNDIcN3DDIcNDIcN3Dx.. JJrz " "T#/%% f < F 9S> !99$)C.911D =111a6!!!QqS!)+<<1aaa6!!!Q!)+<<QYOOO++s2EE99$9''DJE 9>>T3'(E 9>>z!}!!E4:a=)) 4 41I eQq 23333%jj3t~....""$$A GGII  # # #%jj3t~....%jj3t~.... N ! !$'/"6"6"8"8 9 9 9%jj3t~....s5zz"" 3 3AAhGAq! N1  % %a % 2 2 2 2 3 3r#cjdkretjj}t dgjz}t ddd||<t |jdke|jdGjdkrdgSttttfgSjdkrdgjdzSfdtjdDS) z Estimate the min/max values of *data* by subsampling. Returns [(min, max), ...] with one item per channel g.ANrrr)rrrc g|]d}tt|tt|feS)r?)r"rtaker)rrcaxrIs r"rz)ImageView.quickMinMax..sw\\\@A6$))AC)"8"899::6$))AC)"8"899::<\\\r#) rrargmaxrslicerrrMr"rrr)r!rIaxslrRs ` @r"rzImageView.quickMinMaxs i#oo4:&&B++*B4q))BrFb ?D i#oo in ;yA~~x6$<<((%t *=*=>? ?yA~~x$*R.00\\\\\EJ4:VX>EZEZ\\\ \r#c|jjr|S|jj}|t j}|r|t j }|jj r|j dkr| |j jd\}}| |j jd\}}|||dzd}d|jz|_|r||z}n||z}|jjrQ|j dkrF|dd}|jdz|_|r||z}n||z}|jjr|j dkrw|j||jddd}|ddt jt jf}|r||z}n||z}|S) z Process *image* using the normalization options configured in the control panel. This can be repurposed to process any data through the same filter. rrrr?r)rr)rrN)rQrrrrYrrrastypefloat32rr timeIndexr{linesrBrrrrbrArjnewaxis) r!rLdivnormsindreindendr%s r"rzImageView.normalizes. 7  ) ) + + Lg%//11zz"*%%**,,  +;;rz**D 7 % / / 1 1 ejAoo NN4<+=a+@AAMT5..);A)>??KT3d46k"''Q'//AQWnAG    7 ! + + - - %*//  ""''Q'//Ag&AG    7  ) ) + +  a ++D$.&IINNTUNVV[[ab[ccA!!!BJrz)*A    r#c|js|d||j\}}||jkr||_||jrtj|jj |j 5|j &|j |j |n|j |dddn #1swxYwY|j ||dSr)rXrrZrerlrrUr SignalBlockr~rrsetPossigTimeChangedr-)r!r(times r"rzImageView.timeLineChanged*s3"  IIaLLLnnT]33 d $# # # #D          . @$BVWW . .:)M((C9999M((---  . . . . . . . . . . . . . . .   d+++++s ACC#&C#cjdS}|r*jjjjjjdkrgd}ngd}fd|D}| |}j d+jj |j }j|dS)Nrr)rr.rrcDg|]}j|j|Srr5)rrUr!s r"rz)ImageView.updateImage..Is*PPPRdim6O49R=6O6O6Or#r)rLrrQrVr@rIrJrjr transposerMrfr/rlr)r!rArLaxorders` r"rzImageView.updateImage;s :  F&&((  N G  / / t} M M M > #{ 2 2***GG***GPPPP7PPP(( 9S> % GO " " "$+,E ""5)))))r#c(|sdS|}|j}|t|}nLt |dkrdSt j||k}t |dkrd|fS|d}||fS)z Returns ------- int The index of the frame closest to the timeline slider. float The time value of the slider. )rgNrrr)rr)rvaluerrrrargwhere)r!sliderrxvr(indss r"rZzImageView.timeIndexSs!! 6 LLNN Z :a&&CC2ww{{v;rQw''D4yy1}}!t u+CAv r#c|jS)zLReturn the ViewBox (or other compatible object) which displays the ImageItem)rYrs r"getViewzImageView.getViewms yr#c|jS)z(Return the ImageItem for this ImageView.)rjrs r" getImageItemzImageView.getImageItemqs ~r#c|jjS)z,Return the ROI PlotWidget for this ImageView)rQrfrs r" getRoiPlotzImageView.getRoiPlotus wr#c|jjS)z0Return the HistogramLUTWidget for this ImageView)rQrVrs r"getHistogramWidgetzImageView.getHistogramWidgetys w  r#c|}|rtj|\}}dt t |jddzz}t|jdD]D}|j ||d|j ||||fzE| dS|j |dS)a$ Export data from the ImageView to a file, or to a stack of files if the data is 3D. Saving an image stack will result in index numbers being added to the file name. Images are saved as they would appear onscreen, with levels and lookup table applied. z %%s%%0%dd%%srrF)r7N) rrospathsplitextrrrrrjrksaver)r!fileNamerbaseextfmtrs r"exportzImageView.export}s$$&&      *((22ID# 3uSYq\':':1'<#=#==C39Q<(( : :''A5'AAA##C4C.$89999         N   ) ) ) ) )r#cztj\}}|sdS||dSr)r QFileDialoggetSaveFileNamer)r!r~_s r" exportClickedzImageView.exportClickeds?+;;== !  F Hr#c*tj|_tjt dd|j|_|jd|jj |j |j |jtjt dd|j|_ |j j |j|j |j dS)Nr) NormalizationTExport)rQMenur]rQActionr normAction setCheckabletoggledrr3 addAction exportAction triggeredrrs r" buildMenuzImageView.buildMenusO%% - +(O(OQUQZ[[ $$T*** ''(8999 DO,,,!M)K*J*JDIVV #++D,>??? D-.....r#c|j||jtjdSr)r]rpopuprQCursorrrs r"rzImageView.menuClickedsB 9  NN     ))++,,,,,r#cN|jjj|dS)zSet the color map. Parameters ---------- colormap : ColorMap The ColorMap to use for coloring images. N)rQrVgradient setColorMap)r!colormaps r"rzImageView.setColorMaps& "..x88888r#cN|jjj|dS)zwSet one of the gradients defined in :class:`GradientEditorItem`. Currently available gradients are: N)rQrVr loadPreset)r!rKs r"setPredefinedGradientzImageView.setPredefinedGradients& "--d33333r#)Nr)NNr*FNN) TTNNNNNNTNr)T)2r$r%r&__doc__rSignalobjectrer,rrkrrrrrr7rr6rr rrrrrr rrr3rrrrrrrrZrrrtrvrxrrrrrr r __classcell__)r s@r"r)r)1s3<#V]6622N(6=00"jjjj^#ffffP6666" % % % / / / /   ///333   &&&&&2(((((&.   $$$888 ---111$NNN ??? 0 0 0D<3<3<3|\\\,///b,,,"****04!!!***$ ///--- 999 !!44"!44444r#r))+rrzmathrrfrnumpyrrrrrr graphicsItems.GradientEditorItemr graphicsItems.ImageItemr graphicsItems.InfiniteLiner graphicsItems.LinearRegionItemr graphicsItems.ROIr graphicsItems.ViewBoxrgraphicsItems.VTickGrouprrrrrrrrO bottleneckrr ImportErrorQCoreApplicationrrrGr)r'r#r"rs   IIIIII//////555555======######++++++111111))))))))))%%%%%%666666%)))))))))%%%$$$$$$$$$$%  # - 11111c111B4B4B4B4B4 !B4B4B4B4B4s*A33 BB