o
    i                     @   s   d Z ddlmZ ddlmZ ddlmZ ddlmZ	 zddl
Z
edd e
j d	D Zd
ZW n ey<   dZY nw ejdejdejdejdejdejdejdejdiZdedefddZdededefddZdS )zUse GDCM <https://github.com/malaterre/GDCM> to decompress encoded
*Pixel Data*.

This module is not intended to be used directly.
    )castuid)DecodeRunner)PhotometricInterpretationNc                 c   s    | ]}t |V  qd S )N)int).0x r
   R/mnt/sdb/aimis/docanh/lib/python3.10/site-packages/pydicom/pixels/decoders/gdcm.py	<genexpr>   s    r   .TF)zgdcm>=3.0.10r   returnc                 C   s   t rtdk rdS | tv S )zeReturn ``True`` if a pixel data decoder for `uid` is available for use,
    ``False`` otherwise.
    )   r   F)	HAVE_GDCMGDCM_VERSIONDECODER_DEPENDENCIESr   r
   r
   r   is_available#   s   r   srcrunnerc                 C   s  |j }|j}|j}|tjkr|dkrtd|tjkr(|jdkr(|dk r(td|tj	v r5|dv r5tdt
 }||  t
j }|| t
t
dd}||  t
 }|d	 ||j|jdf || t
j|}	|t
|	 |jdkr||j t
j !t"#|}
|$t
 |
 |tj	v r|%d
d |&d|}d|  k rdkrn n|%dd nd|  k rdkrn n|%dd |tj'v r|&d|}d|  k rdkrn n|%dd n(d|  k rdkrn n|%dd nd|  k rdkrn n|%dd t
(|j|j)||d |j}|*| |+ ,dd}|tj'v rH|t-j.t-j/fv rH|%dt-j0 t1t2|S )a.  Return the decoded `src` as :class:`bytes`.

    Parameters
    ----------
    src : bytes
        An encoded pixel data frame.
    runner : pydicom.pixels.decoders.base.DecodeRunner
        The runner managing the decoding.

    Returns
    -------
    bytes
        The decoded pixel data frame.
       zGGDCM does not support 'JPEG Extended' for samples with 12-bit precision   zYUnable to decode signed lossy JPEG-LS pixel data with a sample precision less than 8 bits)      zSUnable to decode unsigned JPEG-LS pixel data with a sample precision of 6 or 7 bitsi        planar_configurationr   jls_precisionbits_allocatedj2k_precision    zutf-8surrogateescapephotometric_interpretation)3transfer_syntaxr"   bits_storedr   JPEGExtended12BitNotImplementedErrorJPEGLSNearLosslesspixel_representation
ValueErrorJPEGLSTransferSyntaxesgdcmFragmentSetByteStringValueSequenceOfFragmentsNewAddFragmentDataElementTagSetValue__ref__ImageSetNumberOfDimensionsSetDimensionscolumnsrowsSetDataElementr   	GetPITypeSetPhotometricInterpretationsamples_per_pixelSetPlanarConfigurationr   TransferSyntax	GetTSTypestr__str__SetTransferSyntax
set_option
get_optionJPEG2000TransferSyntaxesPixelFormatr   SetPixelFormat	GetBufferencodePIYBR_ICTYBR_RCTRGBr   bytes)r   r   tsyntaxr"   r$   fragment	fragmentselemimgpi_typets_typepixel_formatframer
   r
   r   _decode_frame-   s~   










rY   ) __doc__typingr   pydicomr   pydicom.pixels.decoders.baser   pydicom.pixels.commonr   rK   r+   tupleVersion
GetVersionsplitr   r   ImportErrorJPEGBaseline8Bitr%   JPEGLosslessJPEGLosslessSV1JPEGLSLosslessr'   JPEG2000LosslessJPEG2000r   rA   boolr   rO   rY   r
   r
   r
   r   <module>   s.   
