def __init__(self, output_dir, jpeg_decoder=jpeg_bytes_to_img):
    self.output_dir = output_dir
    self.jpeg_decoder = jpeg_decoder
    self.chunk_objs_lookup = OrderedDict(zip(self._chunk_ids(), self._chunks()))
    self.all_meta_dicts = [c.meta_dict for c in self.chunk_objs_lookup.values()]
    self.num_chunks = len(self.chunk_objs_lookup)
    self.chunk_lookup = {}
    for (chunk_id, chunk) in self.chunk_objs_lookup.items():
        for id_ in chunk.meta_dict:
            self.chunk_lookup[id_] = chunk_id
    self.merged_meta_dict = {}
    for d in self.all_meta_dicts:
        for k in d.keys():
            assert (k not in self.merged_meta_dict), 'Duplicate id detected {}'.format(k)
        else:
            self.merged_meta_dict.update(d)
def __init__(self, output_dir, jpeg_decoder=jpeg_bytes_to_img):
    self.output_dir = output_dir
    self.jpeg_decoder = jpeg_decoder
    self.chunk_objs_lookup = OrderedDict(zip(self._chunk_ids(), self._chunks()))
    self.all_meta_dicts = [c.meta_dict for c in self.chunk_objs_lookup.values()]
    self.num_chunks = len(self.chunk_objs_lookup)
    self.chunk_lookup = {}
    for (chunk_id, chunk) in self.chunk_objs_lookup.items():
        for id_ in chunk.meta_dict:
            self.chunk_lookup[id_] = chunk_id
    self.merged_meta_dict = {}
    for d in self.all_meta_dicts:
        for k in d.keys():
            assert (k not in self.merged_meta_dict), 'Duplicate id detected {}'.format(k)
        else:
            self.merged_meta_dict.update(d)