def _build_label_map(self): """ Every label ends with an exclamation point, however, we can't directly search for those to find all the labels as some of the bytes contain the value 33, which is the ASCII code for "!". So we iteratively find each label, grab the subsequent data (always 16 bytes long), advance to the next label and repeat. Returns: LabelMap: the computed label map """ # go 8 bytes back from file end self._fh.seek(-8, 2) chunk_map_start_location = struct.unpack("Q", self._fh.read(8))[0] self._fh.seek(chunk_map_start_location) raw_text = self._fh.read(-1) return LabelMap(raw_text)
def setUp(self): self.nd2 = ArtificialND2('test_data/test_nd2_raw_metadata001.nd2') self.raw_text, self.locations, self.file_data = self.nd2.raw_text, self.nd2.locations, self.nd2.data self.label_map = LabelMap(self.raw_text) self.metadata = RawMetadata(self.nd2.file_handle, self.label_map)
def setUp(self): self.nd2 = ArtificialND2('test_data/test_nd2_label_map001.nd2') self.raw_text, self.locations = self.nd2.raw_text, self.nd2.locations self.label_map = LabelMap(self.raw_text)