示例#1
0
    def __init__(self, image_file, **kwargs):

        from dxtbx import IncorrectFormatError

        if not self.understand(image_file):
            raise IncorrectFormatError(self, image_file)
        FormatSER.__init__(self, image_file, **kwargs)
示例#2
0
    def understand(image_file):

        # check the header looks right
        try:
            fmt = FormatSER(image_file)
        except IncorrectFormatError:
            return False

        # get the first image and check it has the expected dimensions
        im = fmt.get_raw_data(0)
        if im.all() != (4096, 4096): return False

        return True
示例#3
0
    def understand(image_file):

        # check the header looks right
        try:
            fmt = FormatSER(image_file)
        except IncorrectFormatError:
            return False

        # Read metadata and check the image dimension is supported
        d = fmt._read_metadata(image_file)
        image_size = d['ArraySizeX'], d['ArraySizeY']
        if image_size not in [(4096, 4096), (2048, 2048)]: return False

        return True