
    9i                     F    S SK rSSKJr  SSKJr  SSKJr  SSKJ	r	  S	S jr
g)
    N   )warn   )	unwrap_1d)	unwrap_2d)	unwrap_3dc                    U R                   S;  a  [        S5      e[        U[        5      (       a  U/U R                   -  nOq[	        US5      (       aU  [        U[
        5      (       d@  [        U5      U R                   :w  a  [        S5      eU Vs/ s H  n[        U5      PM     nnO[        S5      eU R                   S:X  aD  [        R                  R                  U 5      (       a  [        S5      eUS   (       a  [        S	5      eU R                   S
;   a  SU R                  ;   a  [        S5        [        R                  R                  U 5      (       aE  [        R                  " [        R                  R                  U 5      [        R                  S/5      nO$[        R                  " U [        R                  SS9n[        R                   " [        R                  R#                  U 5      [        R$                  SS9n[        R&                  " U [        R$                  SSS9nU R                   S:X  a  [)        XV5        O;U R                   S:X  a  [+        XTXaU5        OU R                   S:X  a  [-        XTXaU5        [        R                  R                  U 5      (       a(  [        R                  R/                  XdU R0                  S9$ U$ s  snf )a	  Recover the original from a wrapped phase image.

From an image wrapped to lie in the interval [-pi, pi), recover the
original, unwrapped image.

Parameters
----------
image : (M[, N[, P]]) ndarray or masked array of floats
    The values should be in the range [-pi, pi). If a masked array is
    provided, the masked entries will not be changed, and their values
    will not be used to guide the unwrapping of neighboring, unmasked
    values. Masked 1D arrays are not allowed, and will raise a
    `ValueError`.
wrap_around : bool or sequence of bool, optional
    When an element of the sequence is  `True`, the unwrapping process
    will regard the edges along the corresponding axis of the image to be
    connected and use this connectivity to guide the phase unwrapping
    process. If only a single boolean is given, it will apply to all axes.
    Wrap around is not supported for 1D arrays.
rng : {`numpy.random.Generator`, int}, optional
    Pseudo-random number generator.
    By default, a PCG64 generator is used (see :func:`numpy.random.default_rng`).
    If `rng` is an int, it is used to seed the generator.

    Unwrapping relies on a random initialization. This sets the
    PRNG to use to achieve deterministic behavior.

Returns
-------
image_unwrapped : array_like, double
    Unwrapped image of the same shape as the input. If the input `image`
    was a masked array, the mask will be preserved.

Raises
------
ValueError
    If called with a masked 1D array or called with a 1D array and
    ``wrap_around=True``.

Examples
--------
>>> c0, c1 = np.ogrid[-1:1:128j, -1:1:128j]
>>> image = 12 * np.pi * np.exp(-(c0**2 + c1**2))
>>> image_wrapped = np.angle(np.exp(1j * image))
>>> image_unwrapped = unwrap_phase(image_wrapped)
>>> np.std(image_unwrapped - image) < 1e-6   # A constant offset is normal
True

References
----------
.. [1] Miguel Arevallilo Herraez, David R. Burton, Michael J. Lalor,
       and Munther A. Gdeisat, "Fast two-dimensional phase-unwrapping
       algorithm based on sorting by reliability following a noncontinuous
       path", Journal Applied Optics, Vol. 41, No. 35 (2002) 7437,
.. [2] Abdul-Rahman, H., Gdeisat, M., Burton, D., & Lalor, M., "Fast
       three-dimensional phase-unwrapping algorithm based on sorting by
       reliability following a non-continuous path. In W. Osten,
       C. Gorecki, & E. L. Novak (Eds.), Optical Metrology (2005) 32--40,
       International Society for Optics and Photonics.
)r   r      z$Image must be 1, 2, or 3 dimensional__getitem__z>Length of `wrap_around` must equal the dimensionality of imagez[`wrap_around` must be a bool or a sequence with length equal to the dimensionality of imager   z$1D masked images cannot be unwrappedr   z,`wrap_around` is not supported for 1D images)r   r
   zqImage has a length 1 dimension. Consider using an array of lower dimensionality to use a more efficient algorithmC)dtypeorderF)r   r   subokr   r
   )mask
fill_value)ndim
ValueError
isinstanceboolhasattrstrlennpmaisMaskedArrayshaper   requiregetmaskarrayuint8
zeros_likeasarraygetdatafloat64
empty_liker   r   r   arrayr   )imagewrap_aroundrngwar   image_not_maskedimage_unwrappeds          Z/var/www/html/land-doc-ocr/venv/lib/python3.13/site-packages/skimage/restoration/unwrap.pyunwrap_phaser-   
   s   z zz"?@@+t$$"mejj0	m	,	,ZS5Q5Q{uzz)S  +66+BtBx+6:
 	
 zzQ55u%%CDDq>KLLzzVU[[ 0	
 
uu5!!zz"%%,,U3RXXuE}}U"((#>zz"%%--"6bjjPSTmmE3eTOzzQ"4	q"/L	q"/L	uu5!!uu{{?%BRBR{SSI 7s   K
)FN)numpyr   _shared.utilsr   
_unwrap_1dr   
_unwrap_2dr   
_unwrap_3dr   r-        r,   <module>r5      s       ! ! !jr4   