AmirZaghloul / Liver-Tumor-Segmentation-using-CNNs

Deep Convolutinal NN for Liver Tumor Segmentation in CT Scans
34 stars 26 forks source link

Getting error #4

Open hammad2008 opened 3 years ago

hammad2008 commented 3 years ago

When i run the code directory_to_move = "PATIENT_DICOM" desired_scans_path = os.path.join("train", "patients") desired_masks_path = os.path.join("train", "masks") try:
os.mkdir("train")
except OSError as error:
print(error)

try:
os.mkdir(desired_scans_path)
except OSError as error:
print(error)

for patient_path in os.listdir(dataset_path): patient_full_path = os.path.join(dataset_path, patient_path) if os.path.isdir(patient_full_path): patient_scans_path = os.path.join(patient_full_path, "PATIENT_DICOM") if os.path.isdir(patient_scans_path): for scan in os.listdir(patient_scans_path): os.rename(os.path.join(patient_scans_path, scan), os.path.join(desired_scans_path, scan))

try:
os.mkdir(desired_masks_path)
except OSError as error:
print(error)

for patient_path in os.listdir(dataset_path): patient_full_path = os.path.join(dataset_path, patient_path) if(os.path.isdir(patient_full_path)): patient_masks_path = os.path.join(patient_full_path, "MASKS_DICOM") if os.path.isdir(patient_masks_path): for scan in os.listdir(patient_masks_path): os.replace(os.path.join(patient_masks_path, scan), os.path.join(desired_masks_path, scan))

try:
os.mkdir(os.path.join(desired_masks_path, "merged_livertumors"))
except OSError as error:
print(error)

I get this error

[WinError 183] Cannot create a file when that file already exists: 'train' [WinError 183] Cannot create a file when that file already exists: 'train\patients' [WinError 183] Cannot create a file when that file already exists: 'train\masks' [WinError 183] Cannot create a file when that file already exists: 'train\masks\merged_livertumors'

thehealthykrunch commented 2 years ago

The error you are getting because the second notebook should only be run once. To run again you have to delete the train folder itself.

Steps to run the project: