
    9iC                         S SK Jr  S SKrSSKJr  SSKJr  SSK	J
r
  S SKJrJr  SrS	rS
r\" S/ SQ5      rS rS rS rSS jrS rS rS rg)    )
namedtupleN   )dtype)is_low_contrast)warn)floorceilgrayviridisRdBuImageProperties)signedout_of_range_floatlow_data_rangeunsupported_dtypec                    [         R                  " U 5      [         R                  " U 5      p!U R                  R                  n [
        R                  U   u  pEUS:  n[         R                  " U R                  [         R                  5      =(       a    X:  =(       d    X%:  nX:g  =(       a    [        U 5      nU R                  [
        R                  ;  n	[        XgX5      $ ! [         a    XpT Nf = f)a  Determine nonstandard properties of an input image.

Parameters
----------
image : array
    The input image.

Returns
-------
ip : ImageProperties named tuple
    The properties of the image:

    - signed: whether the image has negative values.
    - out_of_range_float: if the image has floating point data
      outside of [-1, 1].
    - low_data_range: if the image is in the standard image
      range (e.g. [0, 1] for a floating point image) but its
      data range would be too small to display with standard
      image ranges.
    - unsupported_dtype: if the image data type is not a
      standard skimage type, e.g. ``numpy.uint64``.
r   )npminmaxr   typedtypesdtype_rangeKeyError
issubdtypefloatingr   _supported_typesr   )
imageimminimmaximtypelohir   r   r   r   s
             e/var/www/html/land-doc-ocr/venv/lib/python3.13/site-packages/skimage/io/_plugins/matplotlib_plugin.py_get_image_propertiesr$      s    . 66%="&&-5[[F##F+ QYFu{{BKK@ 
 ej  ^>(>N6+B+BBN   Bs   C! !C0/C0c                     U nUR                   (       a
  [        SSS9  UR                  (       a
  [        SSS9  UR                  (       a  [        SSS9  gg)zRaise the appropriate warning for each nonstandard image type.

Parameters
----------
image_properties : ImageProperties named tuple
    The properties of the considered image.
zBNon-standard image type; displaying image with stretched contrast.r   )
stacklevelz?Low image data range; displaying image with stretched contrast.zLFloat image out of standard range; displaying image with stretched contrast.N)r   r   r   r   )image_propertiesips     r#   _raise_warningsr)   >   sY     
B	S	
 
P	
 
-	
     c                    [        U 5      n[        R                  " U 5      [        R                  " U 5      p2UR                  (       a)  [        [        U5      [        U5      5      nU* Upe[        nOX[        U5      (       a  [        U5        X#pe[        nO4SnU R                  R                  n[        R                  U   S   n[        nXVU4$ )a  Return the display range for a given set of image properties.

Parameters
----------
image : array
    The input image.

Returns
-------
lo, hi : same type as immin, immax
    The display range to be used for the input image.
cmap : string
    The name of the colormap to use.
r      )r$   r   r   r   r   abs_diverging_colormapanyr)   _nonstandard_colormapr   r   r   r   _default_colormap)	r   r(   r   r   	magnituder!   r"   cmapr    s	            r#   _get_display_ranger4   Y   s     
u	%B66%="&&-5	yyE
CJ/	YB"	RB$!!'* 4<r*   c                    SSK Jn  SSKJn  [	        U 5      u  pgnUR                  SS5        UR                  SU5        UR                  SU5        UR                  SU5        U=(       d    UR                  5       nUR                  " U 40 UD6n	U[        :w  a  US	Ld  U(       a(  U" U5      n
U
R                  S
SSS9nUR                  XS9  UR                  5       R                  5         U	$ )aD  Show the input image and return the current axes.

By default, the image is displayed in grayscale, rather than
the matplotlib default colormap.

Images are assumed to have standard range for their type. For
example, if a floating point image has values in [0, 0.5], the
most intense color will be gray50, not white.

If the image exceeds the standard range, or if the range is too
small to display, we fall back on displaying exactly the range of
the input image, along with a colorbar to clearly indicate that
this range transformation has occurred.

For signed images, we use a diverging colormap centered at 0.

Parameters
----------
image : array, shape (M, N[, 3])
    The image to display.
ax : `matplotlib.axes.Axes`, optional
    The axis to use for the image, defaults to plt.gca().
show_cbar : boolean, optional.
    Whether to show the colorbar (used to override default behavior).
**kwargs : Keyword arguments
    These are passed directly to `matplotlib.pyplot.imshow`.

Returns
-------
ax_im : `matplotlib.pyplot.AxesImage`
    The `AxesImage` object returned by `plt.imshow`.
r   N)make_axes_locatableinterpolationnearestr3   vminvmaxFrightz5%g?)sizepad)cax)matplotlib.pyplotpyplotmpl_toolkits.axes_grid1r6   r4   
setdefaultgcaimshowr1   append_axescolorbar
get_figuretight_layout)r   ax	show_cbarkwargspltr6   r!   r"   r3   ax_imdividerr>   s               r#   rD   rD   z   s    B $;%e,LBD
oy1
fd#
fb!
fb!	swwyBIIe&v&E!!iu&<%b)!!'$!?U$MMO  "Lr*   c                    SSK Jn  [        U 5      S:  a  [        S5      e[        U 5      nUS-  S-  n[	        S[        US-  5      5      n[        US-  5      n[        XF-  5      n[        XG-  5      n	[        Xh-  S-
  5      [        Xy-  S-
  5      :  a  XhpOXypUR                  XS	9u  p[        R                  " U5      R                  5       n[        U 5       H  u  nnX   R                  " U/UQ70 UD6  M      XS
'   U$ )zDisplay all images in the collection.

Returns
-------
fig : `matplotlib.figure.Figure`
    The `Figure` object returned by `plt.subplots`.
r   Nr,   z/Number of images to plot must be greater than 0   g      ?   g      ?)nrowsncolsrI   )r?   r@   len
ValueErrorr   r   r	   r-   subplotsr   asarrayravel	enumeraterD   )icargsrK   rL   
num_imageskr1r2c1c2rR   rS   figaxesrI   nr   s                    r#   imshow_collectionre      s     $
2w{JKK RJ	bS A	Qa!e	B	a!eB	jo	B	jo	B
27T>S400uu56IC	D				!BbM5
U,T,V, "4LJr*   c                  B    SS K nUR                  R                  " U 0 UD6$ )Nr   )matplotlib.imager   imread)r[   rK   
matplotlibs      r#   rh   rh      s!    ""D3F33r*   c                      SSK Jn   U " 5         g )Nr   show)r?   rl   rk   s    r#   	_app_showrm      s
    &Fr*   )NN)collectionsr   numpyr   utilr   r   exposurer   _shared.utilsr   mathr   r	   r1   r0   r.   r   r$   r)   r4   rD   re   rh   rm    r*   r#   <module>ru      sd    "  # ' !   !   K'T
6B3l F4r*   