
    k h$                        d dl Zd dlZd dlmZmZ dZd Zd Zej                  j                  dg d      d        Zd	 Zd
 Zd Zd Zd Zd Zd Zd Zd Zej                  j                  ddd g      d        Zd Zd Zy)    N)flood
flood_fillg-q=c                  &   t        t        j                  d      dd      } | j                  dk(  sJ t	        t        j                  d      d      j
                  t        k(  sJ t	        t        j                  d      d      j                  dk(  sJ y )Nr       )   r      )r   npemptysizer   dtypeboolshape)outputs    /home/developers/rajanand/mypropertyqr-fmb-refixing-v2/venv/lib/python3.12/site-packages/skimage/morphology/tests/test_flood_fill.pytest_empty_inputr   	   su    R+F;;! !b!''4/// *%r*00J>>>    c                      t        j                  g dt         j                        } t        j                  t
        d      5  t        | dd       d d d        y # 1 sw Y   y xY w)N)g      "@g?*   r   zdtype of `image` is float16)matchr      )r
   arrayfloat16pytestraises	TypeErrorr   )images    r   test_float16r      sF    HH^2::6E	y(E	F  5!Q     s   AA#	tolerance)ij   ii{  c                     t        j                  dt         j                        j                  d      }d}t        j                  |      }t        ||d|       }t         j                  j                  ||       y )N   r   )   r$   r	   )   r	   r   r   r    )r
   arangeuint8reshape
zeros_liker   testingassert_equal)r    r   seedexpectedr   s        r   test_overrange_tolerance_intr/      sX    IIc*229=ED}}U#HtQ)<FJJFH-r   c                     t        j                  t         j                        j                  } t         j                  j                  ddd      j                  t         j                        }|| z  }t        j                  |      }t        |dd| j                         dz        }t         j                  j                  ||       y )N)@   r1               ?)r   lowhigh)r   r   
   r&   )r
   finfofloat32maxrandomuniformastype	ones_liker   itemr+   r,   )	max_valuer   r.   r   s       r   test_overrange_tolerance_floatr@   $   s    $((III8C@GG

SE	YE||E"Hvsinn6F6KLFJJFH-r   c                      t        j                  g dg dg dg dg dg      } t        | ddd       t        j                  g d	g d
g d
g dg dg      }t         j                  j	                  | |       y )Nr   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r%   r   r   r   r   r%   r%   r	   r   r      Tin_place)rG   rG   rG   rG   rG   rG   rG   )rG   r   r   rG   r   r   rG   )r   rG   rG   rG   rG   rG   r%   rG   r   r   r   r%   r%   r	   )r
   r   r   r+   assert_array_equalr   r.   s     r   test_inplace_intrM   0   sl    HH!!!!!	
E ufa$/xx!!!!!	
H JJ!!%2r   c                  2   t        j                  g dg dg dg dg dgt         j                        } t        | ddd	       t        j                  g d
g dg dg dg dgt         j                        }t         j                  j                  | |       y )NrB   rC   rD   rE   r   rF   rG   TrH         @rP   rP   rP   rP   rP   rP   rP   r3   r3   rP          @rR   rP   r3   rP   rP   rP   rP   rP         @rP   r3   r3   r3   rT   rT   g      @r
   r   r8   r   r+   assert_allcloserL   s     r   test_inplace_floatrX   J   s~    HH!!!!!	
 jj	E ufa$/xx/////	
 jj	H JJuh/r   c                     t        j                  g dg dg dg dg dg      } | d d dd d df   }t        |ddd	       t        j                  g d
g dg dg      }t         j                  j	                  ||       t        j                  g dg dg dg dg dg      }t         j                  j	                  | |       y )NrB   rC   rD   rE   r   rF   rG   TrH   )rG   rG   rG   rG   )rG   r   r   rG   )rG   r   r%   r	   )rG   r   rG   r   rG   r   rG   )rG   r   r   r   r   r   rG   rJ   )r
   r   r   r+   rW   )r   image2	expected2r.   s       r   test_inplace_noncontiguousr\   f   s    HH!!!!!	
E 3Q3!8_Fvvq40 ,lCDIJJvy1 xx!!!!!	
H JJuh/r   c                     t        j                  d      } t        j                  g d      }t        | ddd      }t        | ddd      }t         j                  j                  ||       t         j                  j                  ||       y )N   )r   r   r_   r_   r_   r_   r_   r_   	   r6   rG   r_   r%   r&   rG   )r
   r'   r   r   r+   r,   )r   r.   r   output2s       r   test_1drc      sf    IIbMExxHIHq#3FcQ7GJJFH-JJFG,r   c                      t        j                  dt         j                        } d| d d df<   t        j                  g dg dg dg dg dg      }t         j                  j                  t        | dd      |       y )NrG      r   d   r%   )r2   r2   r2   g      Y@        rh   rh   rF   )r
   zerosfloat64r   r+   r,   r   )testr.   s     r   test_wraparoundrm      sf     88F"**-DDAJxx44444	
H JJJtVR8(Cr   c                  p   t        j                  dt         j                        } d| d d df<   t        j                  g dg dg dg dg dg      }t	        | dd      }t         j
                  j                  ||       d| d<   d|d<   t	        | d	d      }t         j
                  j                  ||       y )
Nre   r   rg   r%   )r   r   r      r   r   r   )r   r%   ro   r   r   r%   )r
   rj   rk   r   r   r+   r,   )rl   r.   r   rb   s       r   test_neighborsrq      s    88F"**-DDAJxx#####	
H fc*FJJFH-DGHQKvs+GJJGX.r   c                     t        j                  g dg dg dg      } t        t        j                  dt         j                        dd|       }t        j                  g dg dg dg dg d	gt         j                        }t         j
                  j                  ||       t        j                  g dg d
g d
g      } t        t        j                  dt         j                        dd|       }t        j                  g d	g dg dg dg dgt         j                        }t         j
                  j                  ||       y )N)r   r   r   )r   r   r   rG      r   )r%   r   ro   	footprint)r   ro   ro   ro   ro   ro   r   r   r   r   r   r   )r   r   r   )r   r	   )ro   ro   ro   ro   ro   r   r
   r   r   rj   r(   r+   r,   )rv   r   r.   s      r   test_footprintry      s    )Y	:;I
rxx(&#F xx((((	
 hh	H JJFH-)Y	:;I
rxx(&#F xx((((	
 hh	H JJFH-r   c            
      x   dD ]  } d| z  }t        j                  |      }t        d t        |       D              }d||<   t	        |d| z  d      }|j                         d| z  dz  k(  sJ t         j                  j                  |t        j                  t        j                  d| z        dz  dd	              y )
N)r%   r	   rG   ra   c              3   6   K   | ]  }t        d dd        yw)r   ri   N)slice).0dims     r   	<genexpr>z test_basic_nd.<locals>.<genexpr>   s     I%2t,Is   r   )r   r   r%   )r%   constant)
r
   rj   tupleranger   sumr+   r,   padones)	dimensionr   	hypercube	slice_midfilleds        r   test_basic_ndr      s     
	y HHUO	Ii8HII	 	)Iti'7; zz|q)|a//// 	

BFF2774)#34q8!ZH	

r   c                 D   t        j                  g dg dg dgd      }t        j                  g dg dg dgt              }t        |d|       }t         j                  j                  ||       t        |d	|       }t         j                  j                  ||       y )
N)r   r   r   r   )r   r   r   r   )r   r   r   r   F)orderr   )r   r   )
seed_pointr    )r   r   )r
   r   r   r   r+   rK   )r    r   r.   masks       r   test_f_orderr      s    HH	

 E xx	

 H 6Y?DJJ!!(D16Y?DJJ!!(D1r   c                  .   t        j                  g dg dg dg dg dgt         j                        } t        j                  g dg dg dg dg d	gt         j                        }t        | d
d      } t         j                  j                  | |       y )NrB   rC   rD   rE   r   rO   rQ   rS   rU   )r   ri   rG   rV   rL   s     r   !test_negative_indexing_seed_pointr     s~    HH!!!!!	
 jj	E xx/////	
 jj	H ugq)EJJuh/r   c                     t        j                  g dg dg dg dg dg      } t        t        j                  dt         j                        dd|       }t        j                  g d	g d
g dg d
g d	gt         j                        }t         j
                  j                  ||       t        j                  g dg dg dg dg dg      } t        j                  dt         j                        }d|d d df<   t        |dd|       }t        j                  g dg dg dg dg dgt         j                        }t         j
                  j                  ||       y )N)r   r   r   r   r   )r   r   r   r   r   )r   r   r   r   r   rs   r   rp   ro   ru   )r   ro   r   r   r   ro   rw   )r   r   r   ro   r   r   )r   r   r   r   r   )rG   r6   rg   )r%   rf   r$   rF   )
ro   ro   ro   rg   ro   ro   ro   rg   rg   r   rx   )rv   r   r.   r   s       r   test_non_adjacent_footprintr   1  s"   	
I 
rxx(&#F xx" "	
 hh	H JJFH-	
I HHWBHH-EE!Y,vsi@Fxx<<<<<	
 hh	H JJFH-r   )numpyr
   r   skimage.morphologyr   r   epsr   r   markparametrizer/   r@   rM   rX   r\   rc   rm   rq   ry   r   r   r   r   r   r   r   <module>r      s      0	?  &<=. >.	.3408 0F-D&/4&.R
" tQi02 122087.r   