§
    2?Äj  ã                   ó2   — d Z ddlmZ  G d„ de¦  «        ZdS )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dS )ÚFEISEMFormatz!See :mod:`imageio.plugins.feisem`c                 ó   — dS )NF© )ÚselfÚrequests     úGC:\Projects\Historical\venv\Lib\site-packages\imageio/plugins/feisem.pyÚ
_can_writezFEISEMFormat._can_write    s   € Øˆuó    c                   ó(   ‡ — e Zd Zdˆ fd„	Zdd„Zˆ xZS )	úFEISEMFormat.Readeré    TéF   c                 ó†   •— 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$   sN   ø€ õ �\Ô0°$Ñ7Ô7×AÒAÀ%ÑHÔH‰HˆB�Ø ð ,ØÐ*Ð*Ð*Ð*Ô+�Ø�t�8ˆOr   Nc                 óÎ  — t          | d¦  «        r| j        S di i}d}d}| j                             ¦   «         }t	          |dd¬¦  «        5 }|D ]Ê}|s|                     d¦  «        sŒd}|                     ¦   «         }|                     d	¦  «        r.|                     d	¦  «                             d
¦  «        }i ||<   Œsd|v rS|                     dd¬¦  «        \  }}	t          t          fD ]}
	  |
|	¦  «        }	 n# t          $ r Y Œw xY w|	||         |<   ŒË	 ddd¦  «         n# 1 swxY w Y   |d         s%t          |¦  «        dk    rt          d|z  ¦  «        ‚|| _        |S )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   sî  € õ �t˜[Ñ)Ô)ð &Ø”~Ð%à˜"�ˆBØ ˆKØ$ÐØ”|×6Ò6Ñ8Ô8ˆHÝ�h¨¸ÐAÑAÔAð 7ÀSØð 7ð 7�DØ+ð 4Ø#Ÿš¨wÑ7Ô7ð 4Ø$à/3Ð,ØŸ;š;™=œ=�DØ—’ sÑ+Ô+ð 7Ø&*§k¢k°#Ñ&6Ô&6×&=Ò&=¸cÑ&BÔ&B˜Ø*,˜˜;™˜à $˜;˜;Ø'+§z¢z°#À zÑ'BÔ'B™H˜C Ý-0µ%¨Lð *ð * ð!*Ø*2¨(°3©-¬- Cð %* Eøõ (2ð !-ð !-ð !-Ø$, Hð!-øøøð 47˜B˜{œO¨CÑ0øð)7ð7ð 7ð 7ñ 7ô 7ð 7ð 7ð 7ð 7ð 7ð 7øøøð 7ð 7ð 7ð 7ð, �f”:ð W¥# b¡'¤'¨Q¢, ,Ý Ð!JÈXÑ!UÑVÔVÐVàˆDŒNØˆIs7   ÁB$D&Ã0C=Ã;D&Ã=
D
	ÄD&Ä	D
	Ä
D&Ä&D*Ä-D*)r   Tr   )N)Ú__name__Ú
__module__Ú__qualname__r   r:   Ú__classcell__)r   s   @r
   r   r   #   sQ   ø€ € € € € ð	ð 	ð 	ð 	ð 	ð 	ð-	ð -	ð -	ð -	ð -	ð -	ð -	ð -	r   r   N)r;   r<   r=   Ú__doc__r   r   r   r   r   r
   r   r      sV   € € € € € Ø+Ð+ðð ð ð;ð ;ð ;ð ;ð ;�Ô"ñ ;ô ;ð ;ð ;ð ;r   r   N)r?   Útifffiler   r   r   r   r
   ú<module>rA      sa   ððð ð, !Ð  Ð  Ð  Ð  Ð  ðAð Að Að Að A�:ñ Aô Að Að Að Ar   