a
    
dQ                     @   s  d dl Zd dlmZmZmZ d dlZd dlmZ d dl	m
Z
 d dlmZmZmZmZmZmZmZmZmZmZmZmZmZmZ d dlmZ dd Zd	d
 Ze dd Zdd Zdd Z dd Z!dd Z"dd Z#dd Z$dd Z%dd Z&dd Z'dd  Z(d!d" Z)d#d$ Z*d%d& Z+d'd( Z,d)d* Z-d+d, Z.d-d. Z/d/d0 Z0d1d2 Z1d3d4 Z2d5d6 Z3d7d8 Z4d9d: Z5d;d< Z6d=d> Z7d?d@ Z8dAdB Z9dCdD Z:dEdF Z;dGdH Z<dIdJ Z=dKdL Z>dMdN Z?dOdP Z@dQdR ZAdSdT ZBejCjDe
 dUdVdWdX ZEejCjDe
 dUdVdYdZ ZFd[d\ ZGd]d^ ZHd_d` ZIejCjDe
 dUdVdadb ZJejCjDe
 dUdVdcdd ZKejCjDe
 dUdVdedf ZLejCjDe
 dUdVdgdh ZMejCjDe
 dUdVdidj ZNejCjDe
 dUdVdkdl ZOdS )m    N)assert_array_equalassert_equalassert_almost_equal)run_in_parallel)has_mpl)	set_colorlineline_aapolygonpolygon_perimeterdiskcircle_perimetercircle_perimeter_aaellipseellipse_perimeter_bezier_segmentbezier_curve	rectanglerectangle_perimeter)regionpropsc                  C   sT   t d} tdddd\}}t| ||fd t d}d|dd d f< t| | d S )N
   r   r         )npzerosr   r   r   imgrrccimg_ r!   e/var/www/html/stable-diffusion-webui/venv/lib/python3.9/site-packages/skimage/draw/tests/test_draw.pytest_set_color   s    

r#   c                  C   s   t d} tdddd\}}}t| ||fd|d tt$ t| ||fd|d W d    n1 sf0    Y  t d} tdddd\}}}t| ||fd|d d S )	Nr   r   r   r   alpha)   r   r   )r   r      )r   r   r   )r   r   r	   r   pytestraises
ValueError)r   r   r   r%   r!   r!   r"   test_set_color_with_alpha   s    
2
r+   c                  C   sP   t d} tdddd\}}d| ||f< t d}d|dd d f< t| | d S Nr   r   	   r   r   r   r   r   r   r!   r!   r"   test_line_horizontal,   s    

r/   c                  C   sP   t d} tdddd\}}d| ||f< t d}d|d d df< t| | d S r,   r.   r   r!   r!   r"   test_line_vertical9   s    

r0   c                  C   sP   t d} tdddd\}}d| ||f< t d}d|dd d f< t| | d S r,   r.   r   r!   r!   r"   test_line_reverseE   s    

r1   c                  C   s@   t d} tdddd\}}d| ||f< t d}t| | d S )N   r3   r      r   r3   )r   r   r   Zeyer   r   r!   r!   r"   test_line_diagQ   s
    

r5   c                  C   sZ   t d} tdddd\}}}t| ||fd|d t d}d|dd d f< t| | d S )Nr   r   r-   r   r$   )r   r   r	   r   r   r   r   r   valr    r!   r!   r"   test_line_aa_horizontal\   s    

r8   c                  C   sR   t d} tdddd\}}}|| ||f< t d}d|d d df< t| | d S r,   )r   r   r	   r   r6   r!   r!   r"   test_line_aa_verticalh   s    

r9   c                  C   sf   t d} tdddd\}}}d| ||f< tdddd\}}t||D ]\}}t| ||f d qFd S )Nr   r   r-      r   )r   r   r	   r   zipr   )r   r   r   r7   rcZr_iZc_ir!   r!   r"   test_line_aa_diagonalt   s    
r>   c                  C   sd   t d} t d}tdddd\}}}|| ||f< tdddd\}}}||||f< t| |j d S )N   r@   r            )r   r   r	   r   T)Zimg0img1r   r   r7   r!   r!   r"   0test_line_equal_aliasing_horizontally_vertically   s    

rF   c                  C   sv   t dd} t d}t|d d df |d d df \}}d| ||f< t dd}d|ddddf< t| | d S )Nr   uint8)r   r   )r4   r   r4   r4   )r   r4   rH   r   r   r3   r   r   arrayr
   r   r   Zpolyr   r   r    r!   r!   r"   test_polygon_rectangle   s    
&rM   c                  C   s   t dd} t d}t|d d df |d d df \}}d| ||f< t g dg dg dg d	g d
g dg dg dg dg dg
d}t| | d S )Nr   rG   )r   r'   )r4      )rO   r4   )r'   r   rN   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   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   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   r   r   rJ   rL   r!   r!   r"   test_polygon_rectangle_angular   s&    
&	rS   c                  C   s   t dd} t d}t|d d df |d d df \}}d| ||f< t g dg dg dg d	g d	g d	g d
g dg dg dg
d}t| | d S )Nr   rG   )rH   )r3   r   )rO   r:   )r'   r:   rH   r   r   rR   
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   )
r   r   r   r   r   r   r   r   r   r   
r   r   r   r   r   r   r   r   r   r   rJ   rL   r!   r!   r"   test_polygon_parallelogram   s&    
&	rV   c                  C   sx   t dd} t d}t|d d df |d d df | j\}}d| ||f< t d}d|dd d d f< t| | d S )Nr   rG   ))r   )d   rW   )rX   rX   )r   rX   rH   r   r   )r   r   rK   r
   shaper   rL   r!   r!   r"   test_polygon_exceed   s    
*
rZ   c                  C   s0   t dd\} }| j|j  kr&dks,n J d S )Nr   r   )r
   sizer   r   r!   r!   r"   test_polygon_0d_input   s    r]   c                  C   s   t dd} tdd\}}d| ||f< t g dg dg dg dg d	g d	g d	g d	g d	g d	g d	g dg dg dg dg}t| | d S )
N   r_   rG   )rO   rO   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   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   r   r   )r   r   r   rK   r   r   r!   r!   r"   	test_disk   s,    rc   c                  C   s   t dd} tddddd\}}d| ||f< t | dks>J | d d dksRJ t dd} tddddd\}}d| ||f< t g d	g d
g dg dg dg dg dg dg dg dg dg dg dg d
g d	g dg dg}t| | d S )Nr^   rG   rO   r   	bresenhammethodr      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   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   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r`   r   r   r   sumrK   r   r   r!   r!   r"   test_circle_perimeter_bresenham   s:    rn   c                  C   s   t dd} tdddddd\}}d| ||f< d	}t d
d|  dfd}td| dddd d\}}d|||f< t| ||| d d f  d S )Nr_   rC   rG   rO   r   r-   rd   )rf   rY   r   r3   r_   rA   rC   )r   r   r   r   r   r   r   shiftr    r!   r!   r"   %test_circle_perimeter_bresenham_shape  s    rr   c                  C   s   t dd} tddddd\}}d| ||f< t | dks>J | d d dksRJ t dd} tddddd\}}d| ||f< t g d	g d
g dg dg dg dg dg dg dg dg dg dg dg d
g d	g dg dg}t| | d S )Nr^   rG   rO   r   Zandresre   r   rg   ra   )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   rj   )r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   rk   r`   rl   r   r!   r!   r"   test_circle_perimeter_andres&  s:    rs   c                  C   s   t dd} tddd\}}}d| ||f< t | dks<J | d d dksPJ t dd} tddd\}}}|d | ||f< t g d	g d
g dg dg dg dg dg dg dg dg dg dg dg dg dg d
g d	g}t| | d S )Nr^   rG   rO   r   r   )rh   rh      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&   rw   rv   ru   r   r   r   r   r   )r   r   r   r         J      r   r{   rz   ry   rx   r   r   r   r   )r   r   r      r@   r   r   r   r   r   r   r   r@   r|   r   r   r   )r   r   rx   r@   r   r   r   r   r   r   r   r   r   r@   rx   r   r   )r   ru   ry   r   r   r   r   r   r   r   r   r   r   r   ry   ru   r   )r   rv   rz   r   r   r   r   r   r   r   r   r   r   r   rz   rv   r   )r   rw   r{   r   r   r   r   r   r   r   r   r   r   r   r{   rw   r   )r   r&   r   r   r   r   r   r   r   r   r   r   r   r   r   r&   r   )r   r   r   rm   rK   r   r6   r!   r!   r"   test_circle_perimeter_aaF  s:    r}   c                  C   s   t dd} tddddd\}}}|d | ||f< d}t d	d
|  dfd}td| ddd d\}}}|d |||f< t| ||| d d f  d S )Nro   rG   rO   r   r-   rY   r&   r3   r_   rA   rC   )r   r   r   r   )r   r   r   r7   rq   r    r!   r!   r"   test_circle_perimeter_aa_shapef  s    r   c                  C   s  t dd} tdddd\}}d| ||f< t ddgddgg}t| | t dd} tdddd\}}d| ||f< t ddgddgg}t| | t dd} tdddd\}}d| ||f< t g d	g d
g d	g}t| | t dd} tdddd\}}d| ||f< t g d
g dg d
g}t| | t dd} tdddd\}}d| ||f< t g dg dg dg}t| | d S )NrA   rA   rG   g      ?r   r   皙?r'   r'   g?)r   r   r   )r   r   r   )r   r   r         ?r   r   r   rK   r   )r   r   r   Zimg_correctr!   r!   r"   test_ellipse_trivialr  sV    



r   c                  C   sB  t dd} tdddd\}}d| ||f< t g dg dg dg dg}t| | t d	d} td
d
dd\}}d| ||f< t g dg dg dg dg dg}t| | t dd} tdddd\}}d| ||f< t g dg dg dg dg dg dg dg dg dg dg
}t| | t dd} tdddd\}}d| ||f< t g dg dg dg dg dg dg dg dg dg dg
}t| | t dd} tdddd\}}d| ||f< t g dg dg dg dg dg dg dg dg dg dg dg dg dg dg dg}t| | d S )NrI   rG   r   r   333333?r   )r   r   r   r   r   r   r   r   r2   rA   r   r   r   r   r   r   r   r   r   r   r   r3   r'   r4   rR   )
r   r   r   r   r   r   r   r   r   r   )
r   r   r   r   r   r   r   r   r   r   g      @g      @r^   rO   r`   rb   )r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r!   r!   r"   test_ellipse_generic  s    



r   c                  C   s2  t dd} tdddd| jd\}}d| ||f< t g dg dg dg dg dg d	g d	g d	g d	g d	g dg dg dg dg dg}t| | t d
d} tdddd| jd\}}d| ||df< t | }t g dg dg dg dg dg dg dg dg dg dg
|d< t| | d S )Nr^   rG   rO   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   r   r   r   )	r   r   r   r   r   r   r   r   r   .r   )r   r   r   rY   rK   r   
zeros_liker   r!   r!   r"   test_ellipse_with_shape  sP    

r   c               
   C   sd   t dddd\} }ttg dg dg dg dg dg\}}t| |d  t||d  d S )Nr   r   r   r3   )r   r   ZnonzerorK   r   )r   r   Zrr_Zcc_r!   r!   r"   test_ellipse_negative%  s    r   c               
   C   s   t jdt jd} t jdt jd}tdddD ]v}| d tdddd	t |d
\}}d| ||f< |d tdddd	t |d d
\}}d|||f< t| | q,d S )N   r   Zdtyper   rv   r_   P   F   <   (   Zrotationr   )r   r   rG   rangefillr   deg2radr   )rE   Zimg2angler   r   r!   r!   r"   test_ellipse_rotation_symmetry3  s    

 r   c                  C   s   t jdt jd} tdddD ]t}| d t |}tdddd	|d
\}}d| ||f< t| d j}t 	|dt j
d  }t||t j
d  d qd S )N)i  i  r   r   rv   r   i  iX     i  r   r   r'   rA   )r   r   rG   r   r   r   r   r   Zorientationroundpir   )r   Zrotr   r   r   Zangle_estim_rawZangle_estimr!   r!   r"   test_ellipse_rotated@  s    

r   c                  C   sV   t dd} tddddd\}}d| ||f< t | dks>J | d d dksRJ d S Nr   r_   rG   r_   rO   r   r   r   r   r   rm   r   r   r   r!   r!   r"   $test_ellipse_perimeter_dot_zeroangleM  s
    r   c                  C   sV   t dd} tddddd\}}d| ||f< t | dks>J | d d dksRJ d S r   r   r   r!   r!   r"   %test_ellipse_perimeter_dot_nzeroangleV  s
    r   c                  C   sd   t dd} t dd}tddddd\}}d| ||f< tdddd	\}}d|||f< t| | d S )
N)rC   r{   rG   r:   rO   r   r3   r   rA   rB   )r   r   r   r   r   )r   r    r   r   r!   r!   r"   %test_ellipse_perimeter_flat_zeroangle_  s    r   c               !   C   s   t dd} tddddd\}}d| ||f< t g d	g d
g dg dg dg dg dg dg dg dg dg dg dg dg dg dg dg dg dg dg dg dg dg dg dg dg dg dg dg d
g}t| | d S )Nr   rG   r_   rO      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   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   r   r   r   r   ri   rj   r   r   r   rK   r   r   r!   r!   r"    test_ellipse_perimeter_zeroanglej  sJ    !r   c               !   C   s   t dd} tddddd\}}d| ||f< t g d	g d	g d	g d	g d	g d	g d
g dg dg dg dg dg dg dg dg dg dg dg dg dg dg dg dg dg d	g d	g d	g d	g d	g d	g}t| | d S )N)r   r@   rG   r_      rB   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   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   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   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   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   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   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   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   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   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   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   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   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   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   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   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   r!   r!   r"   !test_ellipse_perimeter_nzeroangle  sJ     r   c                  C   s   t dd} tddddddd\}}d| ||f< d	}t d
d|  dfd}td| ddddd d\}}d|||f< t| ||| d d f  d S )Nro   rG   rO   r   r-   r   r~   r   r3   r_   rA   rC   )r   r   r   r   rp   r!   r!   r"   test_ellipse_perimeter_shape  s    r   c            
      C   s   t jdtd} d\}}}d\}}}t||||||d\}}d| ||f< t jdtd}	t||||\}}d|	||f< t| |	 d S )Nr   r   r   )2   r   r   )r   r   r   r   r   )r   r   intr   r   r   )
imager0r1r2c0c1c2r   r   image2r!   r!   r"   test_bezier_segment_straight  s    

r   c            
      C   s  t dd} d\}}d\}}d\}}t||||||d\}}d| ||f< t g dg dg dg dg dg dg dg dg d	g d	g d	g d
g d
g dg dg dg dg dg dg dg dg dg dg dg dg}	t| ||f d t| ||f d t| |	 d S )Nr?   rG   )rC   rC   )rC   rA   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   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   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   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   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   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   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   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   r   r   r   r   r   r   r   r   r   r   r   r   r   )r   r   r   rK   r   r   
r   r   r   r   r   r   r   r   r   r    r!   r!   r"   test_bezier_segment_curved  sJ    r   c            
      C   s   t jdtd} d\}}d\}}d\}}t||||||d\}}d| ||f< t jdtd}	t||||\}}d|	||f< t| |	 d S )Nr   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"   test_bezier_curve_straight  s    r   c            
      C   s  t dd} d\}}d\}}d\}}t||||||d\}}d| ||f< t| ||f d t| ||f d t g dg dg d	g d
g dg dg dg dg dg dg dg dg dg dg dg dg dg dg dg d
g d	g dg dg}	t| |	 d S )N)   rt   rG   rH   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   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   r   r   r   r   rK   r   r!   r!   r"   test_bezier_curved_weight_eq_1  sF    r   c            
      C   s  t dd} d\}}d\}}d\}}t||||||d\}}d| ||f< t| ||f d t| ||f d t g dg d	g d
g dg dg dg dg dg dg dg dg dg dg dg dg dg dg dg dg dg d
g d	g dg}	t| |	 d S )N)r   r   rG   rH   r   r   rA   r   rR   rT   )
r   r   r   r   r   r   r   r   r   r   rP   rQ   )
r   r   r   r   r   r   r   r   r   r   rU   )
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"   test_bezier_curved_weight_neq_1-  sF    r   c               
   C   s   t dd} d\}}d\}}d\}}t||||||ddd\}}d| ||f< d	}	t d
d|	  dfd}
d|	 d	 }}d|	 d }}d|	 d }}t||||||dd d\}}d|
||f< t| |
|	|	 d d f  d S )Nro   rG   )r   r3   )r:   r   )r   r   rA   r~   r   r3   r_   rC   r:   r   r   )r   r   r   r   )r   r   r   r   r   r   r   r   r   rq   r    r!   r!   r"   test_bezier_curve_shapeR  s    r   zmatplotlib not installed)reasonc                  C   s   t g dg dg dg} t | }tg dg d\}}d|||f< t||  t | }tg dg d|jdd	\}}d|||f< t||  tt" td
gdgdd W d    n1 s0    Y  d S )Nr   )r   r   r   r   )r   rA   rA   r   )r   r   r'   r'   r   rW   rW   r'   r'   rW   r4   r4   rW   T)rY   clipr   )r   )	r   rK   r   r   r   rY   r(   r)   r*   )expectedoutr   r   r!   r!   r"   test_polygon_perimeterc  s*    




r   c                  C   s:   t g dg ddd\} }tt| d tt|d d S )Nr   r   )r'   r4   r~   r   )r   r   lenr\   r!   r!   r"   $test_polygon_perimeter_outside_image}  s
    
r   c                  C   s"  t jg dg dg dg dg dgt jd} d}d}t jdt jd}t|||jd\}}d|||f< t||  t jdt jd}t|||jd	\}}d|||f< t||  t jdt jd}td
d|jd\}}d|||f< t||  t jdt jd}td
d|jd	\}}d|||f< t||  d S )Nr   r   r   )r   r   r   r2   endrY   r   r   startrY   )r'   r   rN   r   r   rY   r   rK   rG   r   r   rY   r   r   r   r   r   r   r   r!   r!   r"   test_rectangle_end  s4    



r   c                  C   s"  t jg dg dg dg dg dgt jd} d}d}t jdt jd}t|||jd\}}d|||f< t||  t jdt jd}t|||jd	\}}d|||f< t||  t jdt jd}td
d|jd\}}d|||f< t||  t jdt jd}td
d|jd	\}}d|||f< t||  d S )Nr   r   r   )皙?皙?)@333333@r2   r   r   r   )r   r   )r   r   r   r   r   r!   r!   r"   test_rectangle_float_input  s4    



r   c                  C   s   t jg dg dg dg dg dgt jd} d}d}t jdt jd}t|||jd\}}d|||f< t||  t jd	t jd}t|||jd\}}d|||d
f< t |}| |d< t|| d S )Nr   r   r   rH   r   r2   extentrY   r   )r3   r3   r'   r   r   )r   rK   rG   r   r   rY   r   r   )r   r   r   r   r   r   Z
expected_2r!   r!   r"   test_rectangle_extent  s(    


r   c                  C   s   t jg dg dg dg dg dgt jd} d}d}t j| jt jd}t|||jd\}}d|||f< t|||jd\}}d	|||f< t||  t j| jt jd}t|||jd\}}d	|||f< t|||jd\}}d|||f< t||  d S )
Nr   r   r   r   r   r   r   r   r   r   r   r   )r   r   r   rA   rA   r   r   )r'   r3   )rW   r   r   rA   )r   rK   rG   r   rY   r   r   r   )r   r   r   r   r   r   r!   r!   r"   test_rectangle_extent_negative  s,    

r   c                  C   s   t jg dg dg dg dg dgt jd} d}d}t j| jt jd}t|||jd\}}d|||f< t||  t j| jt jd}t|||jd	\}}d|||f< t||  t j| jt jd}d}d
}t|||jd\}}d|||f< t||  d S )Nr   r   )r   r   r   r   r   r   r   )rA   r'   )rA   r4   r~   r   r   )r   rA   r   )r   rK   rG   r   rY   r   r   )r   r   r   r   r   r   r   r!   r!   r"   test_rectangle_perimiter  s0    


r   c                  C   s   t jg dg dg dg dg dgt jd} t jdt jd}d}d}t|||jdd	\}}d
|||f< t||  t jg dg dg dg dg dgt jd} t jdt jd}t|||jdd	\}}d
|||f< t||  d S )Nr   r   r   r   r   r   r   r   r   r   r   r   r2   r   r   F)r   rY   r   r   r   r   r   r   r   Tr   rK   rG   r   r   rY   r   )r   r   r   r   r   r   r!   r!   r"   *test_rectangle_perimiter_clip_bottom_right  s<    






r   c                  C   s   t jg dg dg dg dg dgt jd} t jdt jd}d}d}t|||jdd	\}}d
|||f< t||  t jg dg dg dg dg dgt jd} t jdt jd}t|||jdd	\}}d
|||f< t||  d S )N)r   r   r   r   r   )r   r   r   r   r   r   r   r2   )r   r   Fr   rY   r   r   )r   r   r   r   r   Tr   r   r   r   r   r   r   r!   r!   r"   &test_rectangle_perimiter_clip_top_left/  s<    






r   c                  C   s   t jg dg dg dg dg dgt jd} t jdt jd}d}d}t|||jdd	\}}d
|||f< t||  t jg dg dg dg dg dgt jd} t jdt jd}t|||jdd	\}}d
|||f< t||  d S )Nr   r   r   r   r2   )irA   )rA   r   Tr   r   r   Fr   r   r!   r!   r"   'test_rectangle_perimiter_clip_top_rightL  s<    






r   c                  C   s   t jg dg dg dg dg dgt jd} t jdt jd}d}d}t|||jdd	\}}d
|||f< t||  t jg dg dg dg dg dgt jd} t jdt jd}t|||jdd	\}}d
|||f< t||  d S )Nr   )r   r   r   r   r   )r   r   r   r   r   r   r2   )rA   r   )r   r   Tr   r   )r   r   r   r   r   Fr   r   r!   r!   r"   )test_rectangle_perimiter_clip_bottom_leftg  s<    






r   )Pnumpyr   Znumpy.testingr   r   r   r(   Zskimage._shared.testingr   Z"skimage._shared._dependency_checksr   Zskimage.drawr   r   r	   r
   r   r   r   r   r   r   r   r   r   r   Zskimage.measurer   r#   r+   r/   r0   r1   r5   r8   r9   r>   rF   rM   rS   rV   rZ   r]   rc   rn   rr   rs   r}   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   markZskipifr   r   r   r   r   r   r   r   r   r   r   r!   r!   r!   r"   <module>   s   @
   2Q0		)('%%






