
    9i                      *    S r SSKJr   " S S\5      rg)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                   H    \ rS rSrSrS r " S S\R                  5      rSrg)FEISEMFormat   z!See :mod:`imageio.plugins.feisem`c                     g)NF )selfrequests     V/var/www/html/land-doc-ocr/venv/lib/python3.13/site-packages/imageio/plugins/feisem.py
_can_writeFEISEMFormat._can_write!   s        c                   6   ^  \ rS rSrSU 4S jjrSS jrSrU =r$ )FEISEMFormat.Reader$   c                 b   > [         [        R                  U ]  U5      u  pEU(       a  USU*  nXE4$ )zGet 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   FEISEMFormat.Reader._get_data%   s9     \00$A%HHB ***+8Or   c                    [        U S5      (       a  U R                  $ S0 0nSnSnU R                  R                  5       n[	        USSS9 nU H  nU(       d  UR                  S5      (       d  M"  SnUR                  5       nUR                  S	5      (       a&  UR                  S	5      R                  S
5      n0 X#'   Mp  SU;   d  Mx  UR                  SSS9u  p[        [        4 H  n
 U
" U	5      n	  O   XU   U'   M     SSS5        US   (       d  [        U5      S:X  a  [        SU-  5      eX l        U$ ! [         a     M_  f = f! , (       d  f       NN= f)zRead 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_data"FEISEMFormat.Reader._get_meta_data2   sJ    t[))~~%"B K$||668HhASD+#w77$/3,;;=Ds++&*kk#&6&=&=c&B*,$;'+zz#z'BHC-0%L!**23-C %* -9 47{OC0)   B, f:#b'Q, !JX!UVVNI (2 !-$,!-# BAs7   A7E!E(D60E6
E	 EE	E
E)r   )    TF   )N)__name__
__module____qualname____firstlineno__r   r<   __static_attributes____classcell__)r   s   @r   r   r   $   s    	-	 -	r   r   r   N)	r@   rA   rB   rC   __doc__r   r   r   rD   r   r   r   r   r      s    +;"" ;r   r   N)rF   tifffiler   r   r   r   r   <module>rH      s   . !A: Ar   