MCPcopy Create free account
hub / github.com/dek924/PerX2CT / buildTrainA

Function buildTrainA

data_preprocessing/ctxray_utils.py:50–66  ·  view source on GitHub ↗
(raw_root_path, save_root_path)

Source from the content-addressed store, hash-verified

48
49# build CycleGAN trainSet A
50def buildTrainA(raw_root_path, save_root_path):
51 files_list = os.listdir(raw_root_path)
52 if not os.path.exists(save_root_path):
53 os.makedirs(save_root_path)
54 start = time.time()
55 for fileIndex, fileName in enumerate(files_list):
56 t0 = time.time()
57 print('Begin {}/{}: {}'.format(fileIndex+1, len(files_list), fileName))
58 imageDir = os.path.join(raw_root_path, fileName)
59 imagePath = os.path.join(imageDir, 'xray1.png')
60 image = cv2.imread(imagePath, 0)
61 savePath = os.path.join(save_root_path, '{}.png'.format(fileName))
62 cv2.imwrite(savePath, image)
63 t1 = time.time()
64 print('End! Case time: {}'.format(t1-t0))
65 end = time.time()
66 print('Finally! Total time of build TrainA: {}'.format(end-start))
67
68# build CycleGAN trainSet B
69def buildTrainB(raw_root_path, save_root_path):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected