def generate(self):
for pid in self.id2candidates_path.iterkeys():
patient_path = self.id2patient_path[pid]
print pid, patient_path
img, pixel_spacing = utils_lung.read_dicom_scan(patient_path)
print self.id2candidates_path[pid]
candidates = utils.load_pkl(self.id2candidates_path[pid])
print candidates.shape
for candidate in candidates:
y_batch = np.array(candidate, dtype='float32')
patch_center = candidate[:3]
batch = []
for i in range(self.tta):
batch.append(np.float32(self.data_prep_fun(data=img,
patch_center=patch_center,
pixel_spacing=pixel_spacing)))
x_batch = np.stack(batch)
print x_batch.shape
yield x_batch, y_batch, [pid]
评论列表
文章目录