def process_images(delete_existing=False, only_process_patient=None):
if delete_existing and os.path.exists(settings.VALIDATION_EXTRACTED_IMAGE_DIR):
print("Removing old stuff..")
if os.path.exists(settings.VALIDATION_EXTRACTED_IMAGE_DIR):
shutil.rmtree(settings.VALIDATION_EXTRACTED_IMAGE_DIR)
if not os.path.exists(settings.VALIDATION_EXTRACTED_IMAGE_DIR):
os.mkdir(settings.VALIDATION_EXTRACTED_IMAGE_DIR)
# os.mkdir(settings.VALIDATION_EXTRACTED_IMAGE_DIR + "_labels/")
for subject_no in range(settings.VAL_SUBSET_START_INDEX, settings.VAL_SUBSET_TRAIN_NUM):
src_dir = settings.RAW_SRC_DIR + "val_subset0" + str(subject_no) + "/"
src_paths = glob.glob(src_dir + "*.mhd")
if only_process_patient is None and True:
pool = multiprocessing.Pool(8)
pool.map(process_image, src_paths)
else:
for src_path in src_paths:
print(src_path)
if only_process_patient is not None:
if only_process_patient not in src_path:
continue
process_image(src_path)
step3_preprocess_validation.py 文件源码
python
阅读 29
收藏 0
点赞 0
评论 0
评论列表
文章目录