Closed mtugsbayar closed 5 years ago
Sorry for the late response. Based on the error, it seems the directory it is trying to save into does not exist. Please add the following lines to the demo_inference code to make sure the directory is created if it doesn't exist:
## Check if save directories exist
if not os.path.exists(DirSaveMask):
os.makedirs(DirSaveMask)
if not os.path.exists(DirSaveData):
os.makedirs(DirSaveData)
Hope this helps.
I see! The directory I've been trying to manually create had the wrong name; it works now with the added lines. Thank you!
Hello! I ran into an issue running inference on ABO data; it ran into an error when saving after post-processing. The postprocessed probability map is there in the nii.gz format, but I'm wondering how I can get the metrics from there.
Traceback is included below. Thank you!
Traceback (most recent call last): File "/home/mtugsbayar/anaconda3/envs/stneuronet/lib/python3.6/site-packages/scipy/io/matlab/mio.py", line 39, in _open_file return open(file_like, mode), True FileNotFoundError: [Errno 2] No such file or directory: '/home/mtugsbayar/Downloads/STNeuroNet/Results/ABO/Test Masks/524691284_neurons.mat'
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "demo_inference.py", line 159, in
sio.savemat(os.path.join(DirSaveMask,name[ind]+'_neurons.mat'),{'finalSegments': np.array(Neurons[0],dtype=int),'MaskCenters':np.array(Neurons[1])})
File "/home/mtugsbayar/anaconda3/envs/stneuronet/lib/python3.6/site-packages/scipy/io/matlab/mio.py", line 266, in savemat
with _open_file_context(file_name, appendmat, 'wb') as file_stream:
File "/home/mtugsbayar/anaconda3/envs/stneuronet/lib/python3.6/contextlib.py", line 81, in enter
return next(self.gen)
File "/home/mtugsbayar/anaconda3/envs/stneuronet/lib/python3.6/site-packages/scipy/io/matlab/mio.py", line 19, in _open_file_context
f, opened = _open_file(file_like, appendmat, mode)
File "/home/mtugsbayar/anaconda3/envs/stneuronet/lib/python3.6/site-packages/scipy/io/matlab/mio.py", line 45, in _open_file
return open(file_like, mode), True
FileNotFoundError: [Errno 2] No such file or directory: '/home/mtugsbayar/Downloads/STNeuroNet/Results/ABO/Test Masks/524691284_neurons.mat'