
    9i
                     F    S r SSKJrJr  SqS rSr\S-   r " S S\5      rg)	am  Read/Write images using SimpleITK.

Backend: `Insight Toolkit <https://itk.org/>`_

.. note::
    To use this plugin you have to install its backend::

        pip install imageio[itk]

The ItkFormat uses the ITK or SimpleITK library to support a range of
ITK-related formats. It also supports a few common formats (e.g. PNG and JPEG).

Parameters
----------
None

   )Format
has_moduleNc                       SS K q[        R                  q[        R                  q[        $ ! [         aF     SS Kq[        R                  q[        R                  q [        $ ! [         a    [        S5      ef = ff = f)N    zitk could not be found. Please try   python -m pip install itk or   python -m pip install simpleitk or refer to   https://itkpythonpackage.readthedocs.io/ for further instructions.)
itk_itkimread_read_functionimwrite_write_functionImportError	SimpleITK	ReadImage
WriteImage     Y/var/www/html/land-doc-ocr/venv/lib/python3.13/site-packages/imageio/plugins/simpleitk.pyload_libr      sx    ,,$ K#  	$!^^N"ooO K  
	,	 	
	s   $, 
A<$A""A88A<)z.giplz.iplz.mhaz.mhdz.nhdrniahdrz.nrrdz.niiz.nii.gzz.imgz.img.gzz.vtkhdf5lsmmncmnc2mghr   pic)	z.bmpz.jpegz.jpgz.pngz.tiffz.tifz.dicomz.dcmz.gdcmc                   x    \ rS rSrSrS rS r " S S\R                  5      r " S S\R                  5      r	S	r
g
)	ItkFormatZ   z$See :mod:`imageio.plugins.simpleitk`c                     UR                   [        ;   a  g[        S5      (       d  [        S5      (       a  UR                   [        ;   $ g NTzitk.ImageIOBaser   	extensionITK_FORMATSr   ALL_FORMATSselfrequests     r   	_can_readItkFormat._can_read]   sB    
 +'((J{,C,C$$33 -Dr   c                     UR                   [        ;   a  g[        S5      (       d  [        S5      (       a  UR                   [        ;   $ g r!   r"   r&   s     r   
_can_writeItkFormat._can_writeg   s@    +'((J{,C,C$$33 -Dr   c                   6    \ rS rSrS	S jrS rS rS rS rSr	g)
ItkFormat.Readero   Nc                     [         (       d
  [        5         SnUb  XA4-  nUb  XB4-  n[        U R                  R	                  5       /UQ76 U l        g )Nr   )r   r   r
   r(   get_local_filename_img)r'   
pixel_typefallback_onlykwargsargss        r   _openItkFormat.Reader._openp   sP    4
D%% ,,,D&t||'F'F'HP4PDIr   c                     g)N   r   r'   s    r   _get_lengthItkFormat.Reader._get_lengthz   s    r   c                     g Nr   r<   s    r   _closeItkFormat.Reader._close}       r   c                 j    US:w  a  Sn[        U5      e[        R                  U R                  5      0 4$ )Nr   z.Index out of range while reading from itk file)
IndexErrorr   GetArrayFromImager3   r'   index	error_msgs      r   	_get_dataItkFormat.Reader._get_data   s5    zL	 ++ ))$))4b88r   c                     Sn[        U5      eNz5The itk plugin does not support meta data, currently.RuntimeErrorrG   s      r   _get_meta_dataItkFormat.Reader._get_meta_data       OIy))r   )r3   )NN)
__name__
__module____qualname____firstlineno__r8   r=   rA   rJ   rP   __static_attributes__r   r   r   Readerr/   o   s    	Q			9	*r   rX   c                   ,    \ rS rSrS rS rS rS rSrg)ItkFormat.Writer   c                 0    [         (       d  [        5         g g r@   )r   r   r<   s    r   r8   ItkFormat.Writer._open   s    4
 r   c                     g r@   r   r<   s    r   rA   ItkFormat.Writer._close   rC   r   c                 t    [         R                  U5      n[        X0R                  R	                  5       5        g r@   )r   GetImageFromArrayr   r(   r2   )r'   immeta_itk_imgs       r   _append_dataItkFormat.Writer._append_data   s'    --b1HHll&E&E&GHr   c                     Sn[        U5      erM   rN   )r'   rc   rI   s      r   set_meta_dataItkFormat.Writer.set_meta_data   rR   r   r   N)	rS   rT   rU   rV   r8   rA   re   rh   rW   r   r   r   WriterrZ      s    			I	*r   rj   r   N)rS   rT   rU   rV   __doc__r)   r,   r   rX   rj   rW   r   r   r   r   r   Z   s/    .44* *>* *r   r   )	rk   corer   r   r   r   r$   r%   r   r   r   r   <module>rm      s?   $ &8,  
 
B* B*r   