ó
ú™xTc           @   sj   d  d l  m Z d  d l m Z d  d l m Z d  d l m Z d  d l m Z d e f d „  ƒ  YZ d S(	   iÿÿÿÿ(   t   division(   t   Format(   t   read_basic_tiff_header(   t   LITTLE_ENDIAN(   t
   BIG_ENDIANt
   FormatTIFFc           B   sJ   e  Z d  Z e Z e Z e d „  ƒ Z e d „  ƒ Z d „  Z d „  Z	 RS(   s   An image reading class for TIFF format images i.e. those from Dectris
  and Rayonix, which start with a standard TIFF header (which is what is
  handled here) and have their own custom header following, which must
  be handled by the inheriting subclasses.c         C   s1   y# t  |  ƒ \ } } } } } t SWn n Xt S(   sW   Check to see if this looks like an TIFF format image, i.e. we can
    make sense of it.(   R   t   Truet   False(   t
   image_filet   widtht   heightt   deptht   headert   order(    (    sE   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/dxtbx/format/FormatTIFF.pyt
   understand   s    c         C   sM   t  |  ƒ \ } } } } } t j |  d ƒ j | ƒ } | | | d | | f S(   s#   Pun to get to the image header etc.t   rbi   (   R   R   t	   open_filet   read(   R   R	   R
   R   R   R   t   header_bytes(    (    sE   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/dxtbx/format/FormatTIFF.pyt   get_tiff_header-   s    c         C   s)   |  j  | ƒ s t ‚ t j |  | ƒ d S(   s3   Initialise the image structure from the given file.N(   R   t   AssertionErrorR   t   __init__(   t   selfR   (    (    sE   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/dxtbx/format/FormatTIFF.pyR   8   s    c         C   sk   t  |  j ƒ \ } } } } } | |  _ | |  _ | d |  _ t j |  j d ƒ j | ƒ |  _ | |  _	 d S(   sZ   Open the image file, read the image header, copy it into memory
    for future inspection.i   R   N(
   R   t   _image_filet   _tiff_widtht   _tiff_heightt   _tiff_depthR   R   R   t   _tiff_header_bytest   _tiff_byte_order(   R   R	   R
   R   R   R   (    (    sE   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/dxtbx/format/FormatTIFF.pyt   _startA   s    			(
   t   __name__t
   __module__t   __doc__R   R   t   staticmethodR   R   R   R   (    (    (    sE   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/dxtbx/format/FormatTIFF.pyR      s   		N(	   t
   __future__R    t   dxtbx.format.FormatR   t   dxtbx.format.FormatTIFFHelpersR   R   R   R   (    (    (    sE   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/dxtbx/format/FormatTIFF.pyt   <module>   s
   