o
    iV                     @   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	W n	 e
y)   Y nw 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 )zUse pyjpegls <https://github.com/pydicom/pyjpegls> to compress *Pixel Data*.

This module is not intended to be used directly.
    )castuid)EncodeRunner_passes_version_checkN)numpyzpyjpegls>=1.3r   returnc                 C   s
   t ddS )zLReturn ``True`` if the decoder has its dependencies met, ``False`` otherwisejpeg_ls)      r   r    r   V/mnt/sdb/aimis/docanh/lib/python3.10/site-packages/pydicom/pixels/encoders/pyjpegls.pyis_available   s   
r   srcrunnerc                 C   sr   | dd}|r|jtjkrtd| d|j|j|j|jd}|jdkr+|j	|d< t
ttj| fd|i|S )	z?Return the image data in `src` as a JPEG-LS encoded codestream.	jls_errorr   zA 'jls_error' value of 'zs' is being used with a transfer syntax of 'JPEG-LS Lossless' - did you mean to use 'JPEG-LS Near Lossless' instead?)rowscolumnssamples_per_pixelbits_storedr   planar_configurationlossy_error)
get_optiontransfer_syntaxr   JPEGLSLossless
ValueErrorr   r   r   r   r   r   	bytearrayr
   encode_pixel_data)r   r   r   optsr   r   r   _encode_frame   s   


r    )__doc__typingr   pydicomr   pydicom.pixels.encoders.baser   pydicom.pixels.utilsr   r
   ImportErrorr   JPEGLSNearLosslessENCODER_DEPENDENCIESstrboolr   bytesr   r    r   r   r   r   <module>   s   