Open brianchu-1248 opened 3 days ago
Thank you for your attention. For your questions:
from PIL import Image
import numpy as np
import glob
import os
img_dir = "xx/xx/octa-500/OCTA_6M_OCTA_part1" # change by yourself save_dir = "./octa-500/OCT2OCTA6M_3D/train/B/" # change by yourself
if not os.path.exists(save_dir): os.makedirs(save_dir)
file_list = [] for subdir, dirs, files in os.walk(img_dir): for f in files: if "bmp" in f: file_list.append(os.path.join(subdir, f)) file_list.sort() print(file_list[0]) print(len(file_list))
for k in range(100):
pid = file_list[k*400].split('/')[-2] # 6M
print(pid)
# img_3d = np.zeros((304,256,304)) # 3M
img_3d = np.zeros((400,256,400)) # 6M
# for i in range (k*304, k*304+304): # 3M
for i in range (k*400, k*400+400):
img_path = file_list[i]
#pid_ = img_path.split('/')[-1].split('_')[0]
pid_ = img_path.split('/')[-2]
assert(pid == pid_)
#idx = int(img_path.split('/')[-1].split('_')[1][:-4])
idx = int(img_path.split('/')[-1].split('.')[0])
img = Image.open(img_path)
img = img.resize((304,256)) # 3M
img = img.resize((400,256)) # 6M
arr_img = np.array(img) # 256,400, 6M; 256, 304, 3M
#img_3d[idx-1,:,:]=arr_img[:,:,0]
img_3d[idx-1,:,:]=arr_img
img_3d = (img_3d-img_3d.min())/(img_3d.max()-img_3d.min())
np.save(save_dir+pid+'.npy', img_3d)
Hi author,
Thank you for sharing the TransPro codebase! It’s been a great resource for my research, and I’m currently working on running the train3d.py script. However, I’ve encountered a couple of issues and would greatly appreciate your advice:
Operating System Compatibility I’m running the code in a Windows environment and ran into a multiprocessing issue. The error suggests using the if name == 'main': syntax to fix it. Could you kindly let me know if the code was developed and tested on Windows, or if it’s optimized for Linux systems? If you’ve used Windows, are there any specific steps or adjustments I should follow to resolve this issue?
Input Data Format I noticed that the input data paths seem to reference .bmp files. However, when running the script, I encountered the following error: 'raise pickle.UnpicklingError: Could not load file containing pickled data' Could you clarify if the input data should indeed be in .bmp format, or if there is a preprocessing step required (e.g., converting data to .npy)?
Lastly, if it’s not too much trouble, may I ask if you’d be open to sharing your preferred method of contact (e.g., email or other platforms) for further clarification if needed?
Thank you very much for your time and help. I truly appreciate the effort you’ve put into this project and look forward to your guidance!
Best regards, brianchu-1248