
    ⨽g                      *    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     _/var/www/it7/html/youtubeDownloader/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%HHB ***+t8Or   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_data2   sX    t[)~~%"B K$||668HhA 7S 7D+#w7$/3,;;=Ds+&*kk#&6&=&=c&B*,;$;'+zz#z'BHC-0%L *!**23-C %** 47B{OC0)77, f:#b'Q, !JX!UVVDNI (2 !-$,!-#7 7s7   	A'D.1%D.DD.	D+	(D.*D+	+D..D7)    TF   )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   