def _start(self):
        """Open the image file, read the image header, copy it into memory
        for future inspection."""

        Format._start(self)

        self._cif_header = FormatCBF.get_cbf_header(self._image_file)

        self._mime_header = ""

        in_binary_format_section = False

        with FormatCBF.open_file(self._image_file, "rb") as fh:
            for record in fh:
                record = record.decode()
                if "--CIF-BINARY-FORMAT-SECTION--" in record:
                    in_binary_format_section = True
                elif in_binary_format_section and record[0] == "X":
                    self._mime_header += record
                if in_binary_format_section and len(record.strip()) == 0:
                    # http://sourceforge.net/apps/trac/cbflib/wiki/ARRAY_DATA%20Category
                    #    In an imgCIF file, the encoded binary data begins after
                    #    the empty line terminating the header.
                    break
Exemple #2
0
  def _start(self):
    '''Open the image file, read the image header, copy it into memory
    for future inspection.'''

    Format._start(self)

    self._cif_header = FormatCBF.get_cbf_header(self._image_file)

    self._mime_header = ''

    in_binary_format_section = False

    for record in FormatCBF.open_file(self._image_file, 'rb'):
      if '--CIF-BINARY-FORMAT-SECTION--' in record:
        in_binary_format_section = True
      elif in_binary_format_section and record[0] == 'X':
        self._mime_header += record
      if in_binary_format_section and len(record.strip()) == 0:
        # http://sourceforge.net/apps/trac/cbflib/wiki/ARRAY_DATA%20Category
        #    In an imgCIF file, the encoded binary data begins after
        #    the empty line terminating the header.
        break

    return
  def _start(self):
    '''Open the image file, read the image header, copy it into memory
    for future inspection.'''

    Format._start(self)

    self._cif_header = FormatCBF.get_cbf_header(self._image_file)

    self._mime_header = ''

    in_binary_format_section = False

    for record in FormatCBF.open_file(self._image_file, 'rb'):
      if '--CIF-BINARY-FORMAT-SECTION--' in record:
        in_binary_format_section = True
      elif in_binary_format_section and record[0] == 'X':
        self._mime_header += record
      if in_binary_format_section and len(record.strip()) == 0:
        # http://sourceforge.net/apps/trac/cbflib/wiki/ARRAY_DATA%20Category
        #    In an imgCIF file, the encoded binary data begins after
        #    the empty line terminating the header.
        break

    return