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
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