Ë
    Eü´j  ã                   ó*   — d Z ddlmZ  G d„ de«      Zy)aM  Read TIFF from FEI SEM microscopes.

Backend Library: internal

This format is based on :mod:`TIFF <imageio.plugins.tifffile>`, and supports the
same parameters. FEI microscopes append metadata as ASCII text at the end of the
file, which this reader correctly extracts.

Parameters
----------
discard_watermark : bool
    If True (default), discard the bottom rows of the image, which
    contain no image data, only a watermark with metadata.
watermark_height : int
    The height in pixels of the FEI watermark. The default is 70.

See Also
--------
    :mod:`imageio.plugins.tifffile`

é   )Ú
TiffFormatc                   ó@   — e Zd ZdZd„ Z G d„ dej                  «      Zy)ÚFEISEMFormatz!See :mod:`imageio.plugins.feisem`c                  ó   — y)NF© )ÚselfÚrequests     úT/root/workspace/ytshorts/venv/lib/python3.12/site-packages/imageio/plugins/feisem.pyÚ
_can_writezFEISEMFormat._can_write    s   € Øó    c                   ó(   ‡ — e Zd Zdˆ fd„	Zdd„Zˆ xZS )úFEISEMFormat.Readerc                 ó\   •— t         t        j                  | �  |«      \  }}|r|d|  }||fS )a"  Get image and metadata from given index.

            FEI images usually (always?) contain a watermark at the
            bottom of the image, 70 pixels high. We discard this by
            default as it does not contain any information not present
            in the metadata.
            N)Úsuperr   ÚReaderÚ	_get_data)r   ÚindexÚdiscard_watermarkÚwatermark_heightÚimÚmetaÚ	__class__s         €r
   r   zFEISEMFormat.Reader._get_data$   s=   ø€ ô œ\×0Ñ0°$ÑAÀ%ÓH‰HˆB�Ù ØÐ*Ð*Ð*Ð+�Ø�t�8ˆOr   c                 ót  — t        | d«      r| j                  S di i}d}d}| j                  j                  «       }t	        |dd¬«      5 }|D ]�  }|s|j                  d«      sŒd}|j                  «       }|j                  d	«      r&|j                  d	«      j                  d
«      }i ||<   Œ`d|v sŒe|j                  dd¬«      \  }}	t        t        fD ]  }
	  |
|	«      }	 n |	||   |<   ŒŸ 	 ddd«       |d   st        |«      dk(  rt        d|z  «      ‚|| _        |S # t        $ r Y ŒWw xY w# 1 sw Y   ŒBxY w)a  Read the metadata from an FEI SEM TIFF.

            This metadata is included as ASCII text at the end of the file.

            The index, if provided, is ignored.

            Returns
            -------
            metadata : dict
                Dictionary of metadata.
            Ú	_fei_metaÚrootFÚutf8Úignore)ÚencodingÚerrorszDate=Tú[ú]ú=r   )ÚmaxsplitNz'Input file %s contains no FEI metadata.)Úhasattrr   r	   Úget_local_filenameÚopenÚ
startswithÚrstripÚlstripÚsplitÚintÚfloatÚ
ValueErrorÚlen)r   r   ÚmdÚcurrent_tagÚreading_metadataÚfilenameÚfinÚlineÚkeyÚvalÚtag_types              r
   Ú_get_meta_dataz"FEISEMFormat.Reader._get_meta_data1   sX  € ô �t˜[Ô)Ø—~‘~Ð%à˜"�ˆBØ ˆKØ$ÐØ—|‘|×6Ñ6Ó8ˆHÜ�h¨¸ÔAð 7ÀSØò 7�DÙ+Ø#Ÿ™¨wÔ7Ø$à/3Ð,ØŸ;™;›=�DØ—‘ sÔ+Ø&*§k¡k°#Ó&6×&=Ñ&=¸cÓ&B˜Ø*,˜˜;šà $š;Ø'+§z¡z°#À zÓ'B™H˜C Ü-0´%¨Lò * ð!*Ù*2°3«- Cñ %*ð*ð 47˜B˜{™O¨CÒ0ñ)7÷7ð, �f’:¤# b£'¨Q¢,Ü Ð!JÈXÑ!UÓVÐVàˆDŒNØˆIøô (2ò !-Ù$,ð!-ú÷#7ð 7ús7   Á	A'D.Â1%D.ÃDÃD.Ä	D+	Ä(D.Ä*D+	Ä+D.Ä.D7)é    TéF   )N)Ú__name__Ú
__module__Ú__qualname__r   r8   Ú__classcell__)r   s   @r
   r   r   #   s   ø„ õ	÷-	r   r   N)r;   r<   r=   Ú__doc__r   r   r   r   r   r
   r   r      s   „ Ù+òô;�×"Ñ"õ ;r   r   N)r?   Útifffiler   r   r   r   r
   ú<module>rA      s   ðñõ, !ôA�:õ Ar   