def __init__(self, image_file, **kwargs):
    '''Initialise the image structure from the given file, including a
    proper model of the experiment.'''

    assert(self.understand(image_file))

    FormatSMVRigaku.__init__(self, image_file, **kwargs)
    def __init__(self, image_file):
        """Initialise the image structure from the given file, including a
    proper model of the experiment."""

        assert self.understand(image_file)

        FormatSMVRigaku.__init__(self, image_file)
  def __init__(self, image_file):
    '''Initialise the image structure from the given file, including a
    proper model of the experiment. Easy from Rigaku Saturn images as
    they contain everything pretty much we need...'''

    assert(self.understand(image_file))

    FormatSMVRigaku.__init__(self, image_file)

    return
Esempio n. 4
0
    def __init__(self, image_file, **kwargs):
        """Initialise the image structure from the given file, including a
        proper model of the experiment. Easy from Rigaku Saturn images as
        they contain everything pretty much we need..."""

        from dxtbx import IncorrectFormatError

        if not self.understand(image_file):
            raise IncorrectFormatError(self, image_file)

        FormatSMVRigaku.__init__(self, image_file, **kwargs)

        self.detector_class = "NOIR1"
        self.detector = "adsc"
  def get_raw_data(self):
    '''Get the pixel intensities (i.e. read the image and return as a
    flex array of integers.)'''

    from boost.python import streambuf
    from dxtbx import read_uint16, read_uint16_bs, is_big_endian
    from scitbx.array_family import flex
    assert(len(self.get_detector()) == 1)
    image_pedestal = int(self._header_dictionary['DARK_PEDESTAL'])
    panel = self.get_detector()[0]
    size = panel.get_image_size()
    f = FormatSMVRigaku.open_file(self._image_file, 'rb')
    f.read(self._header_size)

    if self._header_dictionary['BYTE_ORDER'] == 'big_endian':
      big_endian = True
    else:
      big_endian = False

    if big_endian == is_big_endian():
      raw_data = read_uint16(streambuf(f), int(size[0] * size[1]))
    else:
      raw_data = read_uint16_bs(streambuf(f), int(size[0] * size[1]))

    # apply image pedestal, will result in *negative pixel values*

    raw_data -= image_pedestal

    image_size = panel.get_image_size()
    raw_data.reshape(flex.grid(image_size[1], image_size[0]))

    return raw_data
  def get_raw_data(self):
    '''Get the pixel intensities (i.e. read the image and return as a
    flex array of integers.)'''

    from boost.python import streambuf
    from dxtbx import read_uint16, read_uint16_bs, is_big_endian
    from scitbx.array_family import flex
    assert(len(self.get_detector()) == 1)
    image_pedestal = int(self._header_dictionary['DARK_PEDESTAL'])
    panel = self.get_detector()[0]
    size = panel.get_image_size()
    f = FormatSMVRigaku.open_file(self._image_file, 'rb')
    f.read(self._header_size)

    if self._header_dictionary['BYTE_ORDER'] == 'big_endian':
      big_endian = True
    else:
      big_endian = False

    if big_endian == is_big_endian():
      raw_data = read_uint16(streambuf(f), int(size[0] * size[1]))
    else:
      raw_data = read_uint16_bs(streambuf(f), int(size[0] * size[1]))

    # apply image pedestal, will result in *negative pixel values*

    raw_data -= image_pedestal

    image_size = panel.get_image_size()
    raw_data.reshape(flex.grid(image_size[1], image_size[0]))

    return raw_data
  def understand(image_file):
    '''Check to see if this looks like a ALS 4.2.2 NOIR SMV format image,
    i.e. we can make sense of it. Essentially that will be if it contains
    all of the keys we are looking for.'''

    size, header = FormatSMVRigaku.get_smv_header(image_file)

    wanted_header_items = [
        'DETECTOR_NUMBER', 'DETECTOR_NAMES',
        'CRYSTAL_GONIO_NUM_VALUES', 'CRYSTAL_GONIO_NAMES',
        'CRYSTAL_GONIO_UNITS', 'CRYSTAL_GONIO_VALUES',
        'NOIR1_CREATED',
        'ROTATION', 'ROTATION_AXIS_NAME', 'ROTATION_VECTOR',
        'SOURCE_VECTORS', 'SOURCE_WAVELENGTH',
        'SOURCE_POLARZ', 'DIM', 'SIZE1', 'SIZE2',
        ]

    for header_item in wanted_header_items:
      if not header_item in header:
        return False

    detector_prefix = header['DETECTOR_NAMES'].split()[0].strip()

    more_wanted_header_items = [
        'DETECTOR_DIMENSIONS', 'DETECTOR_SIZE', 'DETECTOR_VECTORS',
        'GONIO_NAMES', 'GONIO_UNITS', 'GONIO_VALUES', 'GONIO_VECTORS',
        'SPATIAL_BEAM_POSITION'
        ]

    for header_item in more_wanted_header_items:
      if not '%s%s' % (detector_prefix, header_item) in header:
        return False

    return True
    def understand(image_file):
        """Check to see if this looks like a Rigaku A200 SMV format image,
        i.e. we can make sense of it. Essentially that will be if it contains
        all of the keys we are looking for."""

        size, header = FormatSMVRigaku.get_smv_header(image_file)

        wanted_header_items = [
            "DETECTOR_NUMBER",
            "DETECTOR_NAMES",
            "CRYSTAL_GONIO_NUM_VALUES",
            "CRYSTAL_GONIO_NAMES",
            "CRYSTAL_GONIO_UNITS",
            "CRYSTAL_GONIO_VALUES",
            "ROTATION",
            "ROTATION_AXIS_NAME",
            "ROTATION_VECTOR",
            "SOURCE_VECTORS",
            "SOURCE_WAVELENGTH",
            "SOURCE_POLARZ",
            "DIM",
            "SIZE1",
            "SIZE2",
        ]

        if any(item not in header for item in wanted_header_items):
            return False

        detector_prefix = header["DETECTOR_NAMES"].split()[0].strip()

        more_wanted_header_items = [
            "DETECTOR_DIMENSIONS",
            "DETECTOR_SIZE",
            "DETECTOR_VECTORS",
            "GONIO_NAMES",
            "GONIO_UNITS",
            "GONIO_VALUES",
            "GONIO_VECTORS",
            "SPATIAL_BEAM_POSITION",
            "SPATIAL_DISTORTION_VECTORS",
        ]

        if any(
            "%s%s" % (detector_prefix, item) not in header
            for item in more_wanted_header_items
        ):
            return False

        descriptive_items = ["DETECTOR_IDENTIFICATION", "DETECTOR_DESCRIPTION"]

        for header_item in descriptive_items:
            test = "%s%s" % (detector_prefix, header_item)
            if test in header and (
                "raxis" in header[test].lower() or "a200" in header[test].lower()
            ):
                return True

        return False
Esempio n. 9
0
    def understand(image_file):
        '''Check to see if this looks like a Rigaku Saturn SMV format image,
    i.e. we can make sense of it. Essentially that will be if it contains
    all of the keys we are looking for.'''

        size, header = FormatSMVRigaku.get_smv_header(image_file)

        if 'DTREK_DATE_TIME' in header:
            return False

        wanted_header_items = [
            'DETECTOR_NUMBER',
            'DETECTOR_NAMES',
            'CRYSTAL_GONIO_NUM_VALUES',
            'CRYSTAL_GONIO_NAMES',
            'CRYSTAL_GONIO_UNITS',
            'CRYSTAL_GONIO_VALUES',
            'ROTATION',
            'ROTATION_AXIS_NAME',
            'ROTATION_VECTOR',
            'SOURCE_VECTORS',
            'SOURCE_WAVELENGTH',
            'SOURCE_POLARZ',
            'DIM',
            'SIZE1',
            'SIZE2',
        ]

        for header_item in wanted_header_items:
            if not header_item in header:
                return False

        detector_prefix = header['DETECTOR_NAMES'].split()[0].strip()

        more_wanted_header_items = [
            'DETECTOR_DIMENSIONS', 'DETECTOR_SIZE', 'DETECTOR_VECTORS',
            'GONIO_NAMES', 'GONIO_UNITS', 'GONIO_VALUES', 'GONIO_VECTORS',
            'SPATIAL_BEAM_POSITION'
        ]

        for header_item in more_wanted_header_items:
            if not '%s%s' % (detector_prefix, header_item) in header:
                return False

        descriptive_items = ['DETECTOR_IDENTIFICATION', 'DETECTOR_DESCRIPTION']

        for header_item in descriptive_items:
            test = '%s%s' % (detector_prefix, header_item)
            if test in header and 'saturn' in header[test].lower():
                return True

        return False
Esempio n. 10
0
    def understand(image_file):
        """Check to see if this looks like a Rigaku d*TREK SMVRigaku format image,
        i.e. we can make sense of it. Essentially that will be if it contains
        all of the keys we are looking for."""

        size, header = FormatSMVRigaku.get_smv_header(image_file)

        if "DETECTOR_TYPE" not in header:
            return False

        if header["DETECTOR_TYPE"] not in ["Pilatus 200K", "Pilatus 300K"]:
            return False

        return True
  def understand(image_file):
    '''Check to see if this looks like a Rigaku d*TREK SMVRigaku format image,
    i.e. we can make sense of it. Essentially that will be if it contains
    all of the keys we are looking for.'''

    size, header = FormatSMVRigaku.get_smv_header(image_file)

    if not 'DETECTOR_TYPE' in header:
      return False

    if header['DETECTOR_TYPE'] != 'Pilatus 300K':
      return False

    return True
Esempio n. 12
0
    def understand(image_file):
        '''Check to see if this looks like a Rigaku d*TREK SMVRigaku format image,
    i.e. we can make sense of it. Essentially that will be if it contains
    all of the keys we are looking for.'''

        size, header = FormatSMVRigaku.get_smv_header(image_file)

        if not 'DETECTOR_TYPE' in header:
            return False

        if header['DETECTOR_TYPE'] != 'Pilatus 300K':
            return False

        return True
Esempio n. 13
0
    def understand(image_file):
        """Check to see if this looks like a ALS 4.2.2 NOIR SMV format image,
        i.e. we can make sense of it. Essentially that will be if it contains
        all of the keys we are looking for."""

        size, header = FormatSMVRigaku.get_smv_header(image_file)

        wanted_header_items = [
            "DETECTOR_NUMBER",
            "DETECTOR_NAMES",
            "CRYSTAL_GONIO_NUM_VALUES",
            "CRYSTAL_GONIO_NAMES",
            "CRYSTAL_GONIO_UNITS",
            "CRYSTAL_GONIO_VALUES",
            "NOIR1_CREATED",
            "ROTATION",
            "ROTATION_AXIS_NAME",
            "ROTATION_VECTOR",
            "SOURCE_VECTORS",
            "SOURCE_WAVELENGTH",
            "SOURCE_POLARZ",
            "DIM",
            "SIZE1",
            "SIZE2",
        ]

        for header_item in wanted_header_items:
            if not header_item in header:
                return False

        detector_prefix = header["DETECTOR_NAMES"].split()[0].strip()

        more_wanted_header_items = [
            "DETECTOR_DIMENSIONS",
            "DETECTOR_SIZE",
            "DETECTOR_VECTORS",
            "GONIO_NAMES",
            "GONIO_UNITS",
            "GONIO_VALUES",
            "GONIO_VECTORS",
            "SPATIAL_BEAM_POSITION",
        ]

        for header_item in more_wanted_header_items:
            if not "%s%s" % (detector_prefix, header_item) in header:
                return False

        return True
  def understand(image_file):
    '''Check to see if this looks like a Rigaku d*TREK SMVRigaku format image,
    i.e. we can make sense of it. Essentially that will be if it contains
    all of the keys we are looking for.'''

    size, header = FormatSMVRigaku.get_smv_header(image_file)

    if not 'DETECTOR_NAMES' in header:
      return False

    name = header['DETECTOR_NAMES']

    if not '%sDETECTOR_DESCRIPTION' % name in header:
      return False

    return 'Eiger1M' in header['%sDETECTOR_DESCRIPTION' % name]
  def understand(image_file):
    '''Check to see if this looks like a Rigaku d*TREK SMVRigaku format image,
    i.e. we can make sense of it. Essentially that will be if it contains
    all of the keys we are looking for.'''

    size, header = FormatSMVRigaku.get_smv_header(image_file)

    if not 'DETECTOR_NAMES' in header:
      return False

    name = header['DETECTOR_NAMES']

    if not '%sDETECTOR_DESCRIPTION' % name in header:
      return False

    return 'Eiger1M' in header['%sDETECTOR_DESCRIPTION' % name]
Esempio n. 16
0
    def understand(image_file):
        """Check to see if this looks like a Rigaku d*TREK SMVRigaku format image,
        i.e. we can make sense of it. Essentially that will be if it contains
        all of the keys we are looking for."""

        size, header = FormatSMVRigaku.get_smv_header(image_file)

        if "DETECTOR_NAMES" not in header:
            return False

        name = header["DETECTOR_NAMES"]

        if "%sDETECTOR_DESCRIPTION" % name not in header:
            return False

        return "Eiger" in header["%sDETECTOR_DESCRIPTION" % name]
  def understand(image_file):
    '''Check to see if this looks like a Rigaku Saturn SMV format image,
    i.e. we can make sense of it. Essentially that will be if it contains
    all of the keys we are looking for.'''

    size, header = FormatSMVRigaku.get_smv_header(image_file)

    if 'DTREK_DATE_TIME' in header:
      return False

    wanted_header_items = [
        'DETECTOR_NUMBER', 'DETECTOR_NAMES',
        'CRYSTAL_GONIO_NUM_VALUES', 'CRYSTAL_GONIO_NAMES',
        'CRYSTAL_GONIO_UNITS', 'CRYSTAL_GONIO_VALUES',
        'ROTATION', 'ROTATION_AXIS_NAME', 'ROTATION_VECTOR',
        'SOURCE_VECTORS', 'SOURCE_WAVELENGTH',
        'SOURCE_POLARZ', 'DIM', 'SIZE1', 'SIZE2',
        ]

    for header_item in wanted_header_items:
      if not header_item in header:
        return False

    detector_prefix = header['DETECTOR_NAMES'].split()[0].strip()

    more_wanted_header_items = [
        'DETECTOR_DIMENSIONS', 'DETECTOR_SIZE', 'DETECTOR_VECTORS',
        'GONIO_NAMES', 'GONIO_UNITS', 'GONIO_VALUES', 'GONIO_VECTORS',
        'SPATIAL_BEAM_POSITION'
        ]

    for header_item in more_wanted_header_items:
      if not '%s%s' % (detector_prefix, header_item) in header:
        return False

    descriptive_items = [
        'DETECTOR_IDENTIFICATION', 'DETECTOR_DESCRIPTION'
    ]

    for header_item in descriptive_items:
      test = '%s%s' % (detector_prefix, header_item)
      if test in header and 'saturn' in header[test].lower():
        return True

    return False
Esempio n. 18
0
    def understand(image_file):
        '''Check to see if this looks like a ALS 4.2.2 NOIR SMV format image,
    i.e. we can make sense of it. Essentially that will be if it contains
    all of the keys we are looking for.'''

        size, header = FormatSMVRigaku.get_smv_header(image_file)

        wanted_header_items = [
            'DETECTOR_NUMBER',
            'DETECTOR_NAMES',
            'CRYSTAL_GONIO_NUM_VALUES',
            'CRYSTAL_GONIO_NAMES',
            'CRYSTAL_GONIO_UNITS',
            'CRYSTAL_GONIO_VALUES',
            'NOIR1_CREATED',
            'ROTATION',
            'ROTATION_AXIS_NAME',
            'ROTATION_VECTOR',
            'SOURCE_VECTORS',
            'SOURCE_WAVELENGTH',
            'SOURCE_POLARZ',
            'DIM',
            'SIZE1',
            'SIZE2',
        ]

        for header_item in wanted_header_items:
            if not header_item in header:
                return False

        detector_prefix = header['DETECTOR_NAMES'].split()[0].strip()

        more_wanted_header_items = [
            'DETECTOR_DIMENSIONS', 'DETECTOR_SIZE', 'DETECTOR_VECTORS',
            'GONIO_NAMES', 'GONIO_UNITS', 'GONIO_VALUES', 'GONIO_VECTORS',
            'SPATIAL_BEAM_POSITION'
        ]

        for header_item in more_wanted_header_items:
            if not '%s%s' % (detector_prefix, header_item) in header:
                return False

        return True
Esempio n. 19
0
    def _start(self):

        FormatSMVRigaku._start(self)
Esempio n. 20
0
  def _start(self):

    FormatSMVRigaku._start(self)
    from iotbx.detectors.dtrek import DTREKImage
    self.detectorbase = DTREKImage(self._image_file)
    self.detectorbase.readHeader()
  def _start(self):

    FormatSMVRigaku._start(self)
  def _start(self):

    FormatSMVRigaku._start(self)
    from iotbx.detectors.saturn import SaturnImage
    self.detectorbase = SaturnImage(self._image_file)
    self.detectorbase.readHeader()