Hi @tommydino93,
I am new to Python and Github communities so please excuse me if my question is naive or inexperience in anyway.
When I try to follow your code, I got an error during the dataset_creation process, the positive patches creation to be specific (the negative patches creation process runs smoothly). The following error are one example when I try to run on 1 sample only (sub-075). The error seems like it is due to the fact that the code cannot create a temporary patch for the first lesion_1 unlike the negative patch. Do you have any idea why it leads to this problem? I copy the error below.
Thank you in advance for your kind reply if possible.
Began extraction of positive patches...
-------------------------- sub-075_ses-20100502_Lesion_1 --------------------------
Traceback (most recent call last):
File "E:\Projects\Cerebral_Aneurysm_Segmentation\Aneurysm_Detection-main\dataset_creation\create_dataset_patches_neg_and_pos.py", line 606, in
main()
File "E:\Projects\Cerebral_Aneurysm_Segmentation\Aneurysm_Detection-main\dataset_creation\create_dataset_patches_neg_and_pos.py", line 583, in main
create_patch_ds(bids_dataset_path,
File "E:\Projects\Cerebral_Aneurysm_Segmentation\Aneurysm_Detection-main\dataset_creation\create_dataset_patches_neg_and_pos.py", line 486, in create_patch_ds
Parallel(n_jobs=n_parallel_jobs, backend='loky')(delayed(extract_positive_patches)(all_subdirs[idx],
File "c:\Users\ADMIN\anaconda3\envs\tensorflow-gpu\lib\site-packages\joblib\parallel.py", line 1863, in call
return output if self.return_generator else list(output)
File "c:\Users\ADMIN\anaconda3\envs\tensorflow-gpu\lib\site-packages\joblib\parallel.py", line 1792, in _get_sequential_output
res = func(*args, **kwargs)
File "E:\Projects\Cerebral_Aneurysm_Segmentation\Aneurysm_Detection-main\dataset_creation\create_dataset_patches_neg_and_pos.py", line 363, in extract_positive_patches
nib.save(patch_mask_obj_translated_scale_1, os.path.join(pos_patches_masks_path, patch_mask_name_transl_scale_1))
File "c:\Users\ADMIN\anaconda3\envs\tensorflow-gpu\lib\site-packages\nibabel\loadsave.py", line 163, in save
img.to_filename(filename, **kwargs)
File "c:\Users\ADMIN\anaconda3\envs\tensorflow-gpu\lib\site-packages\nibabel\filebasedimages.py", line 307, in to_filename
self.to_file_map(**kwargs)
File "c:\Users\ADMIN\anaconda3\envs\tensorflow-gpu\lib\site-packages\nibabel\nifti1.py", line 2219, in to_file_map
super().to_file_map(file_map, dtype)
File "c:\Users\ADMIN\anaconda3\envs\tensorflow-gpu\lib\site-packages\nibabel\analyze.py", line 1037, in to_file_map
hdrf = hdr_fh.get_prepare_fileobj(mode='wb')
File "c:\Users\ADMIN\anaconda3\envs\tensorflow-gpu\lib\site-packages\nibabel\fileholders.py", line 74, in get_prepare_fileobj
obj = ImageOpener(self.filename, *args, **kwargs)
File "c:\Users\ADMIN\anaconda3\envs\tensorflow-gpu\lib\site-packages\nibabel\openers.py", line 182, in init
self.fobj = opener(fileish, *args, **kwargs)
File "c:\Users\ADMIN\anaconda3\envs\tensorflow-gpu\lib\site-packages\nibabel\openers.py", line 91, in _gzip_open
gzip_file = DeterministicGzipFile(filename, mode, compresslevel, mtime=mtime)
File "c:\Users\ADMIN\anaconda3\envs\tensorflow-gpu\lib\site-packages\nibabel\openers.py", line 72, in init
fileobj = self.myfileobj = ty.cast(io.FileIO, open(filename, modestr))
FileNotFoundError: [Errno 2] No such file or directory: 'E:/Projects/Cerebral_Aneurysm_Segmentation/Aneurysm_Detection-main/output_dataset_path_temp\Data_Set_Dec_01_2023_unique_identifier\Positive_Patches_Masks\sub-075_ses-20100502_Lesion_1\patch_pair_1\sub-075_ses-20100502_Lesion_1_patch_pair_1_transl_mask_patch.nii.gz'