Ë
    îì�iê  ã                   óL   — d dl Zd dlmZmZ d„ Zdej                  ddfddœd„Zy)	é    N)ÚcKDTreeÚdistancec                 óð  — t        | «      }|j                  | ||¬«      }t        «       }d}t        |«      D ]Ž  \  }}	||vsŒ|	j	                  |«       t        j                  | |   g| |	   d|¬«      j                  d«      }
t        |	|
«      D ��cg c]  \  }}||k  sŒ|‘Œ }	}}|j                  |	«       |dz  }|€Œˆ||k\  sŒŽ n t        j                  | t        |«      d¬«      }|�|d| }|S c c}}w )	aÍ  Returns a subset of coord where a minimum spacing is guaranteed.

    Parameters
    ----------
    coord : ndarray
        The coordinates of the considered points.
    spacing : float
        the maximum allowed spacing between the points.
    p_norm : float
        Which Minkowski p-norm to use. Should be in the range [1, inf].
        A finite large p may cause a ValueError if overflow can occur.
        ``inf`` corresponds to the Chebyshev distance and 2 to the
        Euclidean distance.
    max_out : int
        If not None, at most the first ``max_out`` candidates are
        returned.

    Returns
    -------
    output : ndarray
        A subset of coord where a minimum spacing is guaranteed.

    )ÚrÚpr   Ú	minkowski)r   éÿÿÿÿé   N)Úaxis)r   Úquery_ball_pointÚsetÚ	enumerateÚremover   ÚcdistÚreshapeÚzipÚupdateÚnpÚdeleteÚtuple)ÚcoordÚspacingÚp_normÚmax_outÚtreeÚindicesÚrejected_peaks_indicesÚ	nacceptedÚidxÚ
candidatesÚdistÚcÚdÚoutputs                 úz/var/www/ITT-ServiceAPI-Services/ITT-Document-Scan/mrzscanner/mrzenv/lib/python3.12/site-packages/skimage/_shared/coord.pyÚ_ensure_spacingr&      s  € ô4 �5‹>€Dà×#Ñ# E¨W¸Ð#Ó?€GÜ ›UÐØ€IÜ$ WÓ-ò ‰ˆˆZØÐ,Ò,à×Ñ˜cÔ"Ü—>‘>Ø�s‘�˜e JÑ/°Àôç‰g�b‹kð ô ),¨J¸Ó(=×M¡  1ÀÀWÃš!ÐMˆJÑMð #×)Ñ)¨*Ô5Ø˜‰NˆIØÑ" y°GÓ';Ùðô  �Y‰Y�uœeÐ$:Ó;À!ÔD€FØÐØ˜˜Ð!ˆà€Mùó Ns   ÂC2ÂC2r
   é2   iÐ  )Úmax_split_sizec                óø  — | }t        | «      rìt        j                  | «      } |€| g}nct        | «      }|g}	|}
||	d   z
  |kD  r2|
dz  }
|	j                  |	d   t	        |
|«      z   «       ||	d   z
  |kD  rŒ2t        j
                  | |	«      }t        j                  d| j                  d   f| j                  ¬«      }|D ]9  }t        t        j                  ||g«      |||«      }|€Œ)t        |«      |k\  sŒ8 |S  |S )a§  Returns a subset of coord where a minimum spacing is guaranteed.

    Parameters
    ----------
    coords : array_like
        The coordinates of the considered points.
    spacing : float
        the maximum allowed spacing between the points.
    p_norm : float
        Which Minkowski p-norm to use. Should be in the range [1, inf].
        A finite large p may cause a ValueError if overflow can occur.
        ``inf`` corresponds to the Chebyshev distance and 2 to the
        Euclidean distance.
    min_split_size : int
        Minimum split size used to process ``coords`` by batch to save
        memory. If None, the memory saving strategy is not applied.
    max_out : int
        If not None, only the first ``max_out`` candidates are returned.
    max_split_size : int
        Maximum split size used to process ``coords`` by batch to save
        memory. This number was decided by profiling with a large number
        of points. Too small a number results in too much looping in
        Python instead of C, slowing down the process, while too large
        a number results in large memory allocations, slowdowns, and,
        potentially, in the process being killed -- see gh-6010. See
        benchmark results `here
        <https://github.com/scikit-image/scikit-image/pull/6035#discussion_r751518691>`_.

    Returns
    -------
    output : array_like
        A subset of coord where a minimum spacing is guaranteed.

    r	   é   r   r
   )Údtype)Úlenr   Ú
atleast_2dÚappendÚminÚarray_splitÚzerosÚshaper+   r&   Úvstack)Úcoordsr   r   Úmin_split_sizer   r(   r$   Ú
batch_listÚcoord_countÚ	split_idxÚ
split_sizeÚbatchs               r%   Úensure_spacingr;   ;   s  € ðV €FÜ
ˆ6„{Ü—‘˜vÓ&ˆØÐ!Ø ˜‰Jä˜f›+ˆKØ'Ð(ˆIØ'ˆJØ 	¨"¡Ñ-°Ò>Ø˜a‘�
Ø× Ñ  ¨2¡´°ZÀÓ1PÑ!PÔQð  	¨"¡Ñ-°Ó>ô Ÿ™¨°	Ó:ˆJä—‘˜1˜fŸl™l¨1™oÐ.°f·l±lÔCˆØò 	ˆEÜ$Ü—	‘	˜6 5˜/Ó*¨G°V¸WóˆFð Ñ"¤s¨6£{°gÓ'=Øà€Mð	ð €Mó    )Únumpyr   Úscipy.spatialr   r   r&   Úinfr;   © r<   r%   ú<module>rA      s4   ðÛ ß +ò3ðp Ø�6‰6ØØðAð õAr<   