Ë
    îì�iÆ  ã                   ó.   — d dl mZ d dlZdgZddddœd„Zy)é    NÚcontingency_tableFÚmatrix)Úignore_labelsÚ	normalizeÚsparse_typec                óp  — |€g }|j                  d«      }| j                  d«      }t        j                  ||d¬«      j                  t        «      }|r|t        j
                  |«      z  }t        j                  |||ff«      }|dk(  rt        j                  |«      }|S |dk7  rd|› �}	t        |	«      ‚|S )aÕ  
    Return the contingency table for all regions in matched segmentations.

    Parameters
    ----------
    im_true : ndarray of int
        Ground-truth label image, same shape as im_test.
    im_test : ndarray of int
        Test image.
    ignore_labels : sequence of int, optional
        Labels to ignore. Any part of the true image labeled with any of these
        values will not be counted in the score.
    normalize : bool
        Determines if the contingency table is normalized by pixel count.
    sparse_type : {"matrix", "array"}, optional
        The return type of `cont`, either `scipy.sparse.csr_array` or
        `scipy.sparse.csr_matrix` (default).

    Returns
    -------
    cont : scipy.sparse.csr_matrix or scipy.sparse.csr_array
        A contingency table. `cont[i, j]` will equal the number of voxels
        labeled `i` in `im_true` and `j` in `im_test`. Depending on `sparse_type`,
        this can be returned as a `scipy.sparse.csr_array`.
    éÿÿÿÿT)Úinvertr   Úarrayz/`sparse_type` must be 'array' or 'matrix', got )
ÚreshapeÚnpÚisinÚastypeÚfloatÚcount_nonzeroÚsparseÚ	csr_arrayÚ
csr_matrixÚ
ValueError)
Úim_trueÚim_testr   r   r   Ú	im_test_rÚ	im_true_rÚdataÚcontÚmsgs
             ú‡/var/www/ITT-ServiceAPI-Services/ITT-Document-Scan/mrzscanner/mrzenv/lib/python3.12/site-packages/skimage/metrics/_contingency_table.pyr   r      s¾   € ð: ÐØˆØ—‘ Ó#€IØ—‘ Ó#€IÜ�7‰7�9˜m°DÔ9×@Ñ@ÄÓG€DÙØ”× Ñ  Ó&Ñ&ˆÜ×Ñ˜T I¨yÐ#9Ð:Ó;€Dà�hÒÜ× Ñ  Ó&ˆð
 €Kð	 
˜Ò	Ø?À¸}ÐMˆÜ˜‹oÐà€Kó    )Úscipy.sparser   Únumpyr   Ú__all__r   © r   r   ú<module>r#      s!   ðÝ Û àÐ
€ð (,°uÈ(õ,r   