예제 #1
0
파일: FormatTIFF.py 프로젝트: hbrunie/dxtbx
    def understand(image_file):
        """Check to see if this looks like an TIFF format image, i.e. we can
        make sense of it."""

        try:
            read_basic_tiff_header(image_file)
            return True

        except Exception:
            pass

        return False
예제 #2
0
def get_tiff_header(image_file):
    width, height, depth, header, order = read_basic_tiff_header(image_file)

    with open(image_file, "rb") as fh:
        header_bytes = fh.read(header)

    return width, height, depth // 8, order, header_bytes
예제 #3
0
def get_tiff_header(image_file):
    from dxtbx.format.FormatTIFFHelpers import read_basic_tiff_header
    width, height, depth, header, order = read_basic_tiff_header(image_file)

    header_bytes = open(image_file, 'rb').read(header)

    return width, height, depth // 8, order, header_bytes
예제 #4
0
    def understand(image_file):
        """Check to see if this looks like a TIFF format image of the type
        expected from the DE detector"""

        btf = read_basic_tiff_header(image_file)
        if btf[3] is None:
            return True
        return False
예제 #5
0
  def get_tiff_header(image_file):
    '''Pun to get to the image header etc.'''

    width, height, depth, header, order = read_basic_tiff_header(
        image_file)

    header_bytes = FormatTIFF.open_file(image_file, 'rb').read(header)

    return width, height, depth // 8, order, header_bytes
예제 #6
0
    def get_tiff_header(image_file):
        """Pun to get to the image header etc."""

        width, height, depth, header, order = read_basic_tiff_header(
            image_file)

        header_bytes = FormatTIFF.open_file(image_file, "rb").read(header)

        return width, height, depth // 8, order, header_bytes
예제 #7
0
  def understand(image_file):
    '''Check to see if this looks like an TIFF format image, i.e. we can
    make sense of it.'''

    try:
      width, height, depth, header, order = read_basic_tiff_header(
          image_file)
      return True

    except: # intentional
      pass

    return False
예제 #8
0
    def _start(self):
        """Open the image file, read the image header, copy it into memory
        for future inspection."""

        width, height, depth, header, order = read_basic_tiff_header(
            self._image_file)

        self._tiff_width = width
        self._tiff_height = height
        self._tiff_depth = depth // 8
        self._tiff_header_bytes = FormatTIFF.open_file(self._image_file,
                                                       "rb").read(header)
        self._tiff_byte_order = order
예제 #9
0
    def understand(image_file):
        '''Check to see if this looks like an TIFF format image, i.e. we can
    make sense of it.'''

        try:
            width, height, depth, header, order = read_basic_tiff_header(
                image_file)
            return True

        except:  # intentional
            pass

        return False
예제 #10
0
  def _start(self):
    '''Open the image file, read the image header, copy it into memory
    for future inspection.'''

    width, height, depth, header, order = read_basic_tiff_header(
        self._image_file)

    self._tiff_width = width
    self._tiff_height = height
    self._tiff_depth = depth // 8
    self._tiff_header_bytes = FormatTIFF.open_file(
        self._image_file, 'rb').read(header)
    self._tiff_byte_order = order

    return
예제 #11
0
    def understand(image_file):
        """Check to see if this looks like an TIFF format image, i.e. we can
        make sense of it."""

        return bool(read_basic_tiff_header(image_file))