
    1-PhC                         d dl mZ d dlZddlmZ ddlmZ ddl	m
Z
 d dlmZmZ dZd	Zd
Z edg d          Zd Zd Zd ZddZd Zd Zd ZdS )    )
namedtupleN   )dtype)is_low_contrast)warn)floorceilgrayviridisRdBuImageProperties)signedout_of_range_floatlow_data_rangeunsupported_dtypec                    t          j        |           t          j        |           }}| j        j        }	 t
          j        |         \  }}n# t          $ r ||}}Y nw xY w|dk     }t          j        | j        t           j	                  o||k     p||k    }||k    ot          |           }| j        t
          j        v}	t          ||||	          S )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/test/jupyter/venv/lib/python3.11/site-packages/skimage/io/_plugins/matplotlib_plugin.py_get_image_propertiesr$      s    . 6%=="&--5E[F#F+BB   B QYFu{BK@@ 
 ebj  e^>(>(>N6+BB"N4E  s   A AAc                     | }|j         rt          dd           |j        rt          dd           |j        rt          dd           dS dS )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)   >   s     
B	 
S	
 	
 	
 	
 
 
P	
 	
 	
 	
 
 
-	
 	
 	
 	
 	
 	

 
    c                    t          |           }t          j        |           t          j        |           }}|j        r7t          t          |          t          |                    }| |}}t          }nWt          |          rt          |           ||}}t          }n-d}| j
        j        }t          j        |         d         }t          }|||fS )aA  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6%=="&--5E	y !E

CJJ//	YB"	R !B$!'* r4<r*   c                    ddl m} ddlm} t	          |           \  }}}|                    dd           |                    d|           |                    d|           |                    d|           |p|                                } |j        | fi |}	|t          k    r|d	us|r: ||          }
|
	                    d
dd          }|
                    |	|           |                                                                 |	S )a  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   s8   B $#####;;;;;;%e,,LBD
oy111
fd###
fb!!!
fb!!!	swwyyBBIe&&v&&E!!!iu&<&<&<%%b))!!'$!??U$$$MMOO  """Lr*   c                 |   ddl m} t          |           dk     rt          d          t          |           }|dz  dz  }t	          dt          |dz                      }t          |dz            }t          ||z            }t          ||z            }	t          ||z  dz
            t          ||	z  dz
            k     r||}}
n||	}}
|                    |
|	          \  }}t          j
        |                                          }t          |           D ]\  }} ||         j        |g|R i | ||d
<   |S )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\    $#####
2ww{{JKKK RJ	bS A	Qa!e		B	a!eB	j2o		B	j2o		B
27T>Sb400002u2u566IC	D					!	!BbMM - -51U,T,,,V,,,,F4LJr*   c                  .    dd l } |j        j        | i |S )Nr   )matplotlib.imager   imread)r[   rK   
matplotlibs      r#   rh   rh      s)    ":"D3F333r*   c                  &    ddl m}   |              d S )Nr   show)r?   rl   rk   s    r#   	_app_showrm      s#    &&&&&&DFFFFFr*   )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      s    " " " " " "     # # # # # # ' ' ' ' ' ' ! ! ! ! ! !          !   *KKK ' ' 'T
 
 
6  B3 3 3 3l     F4 4 4    r*   