brats17 icon indicating copy to clipboard operation
brats17 copied to clipboard

ERROR (nifti_image_write_hdr_img2): cannot open output file

Open zaabahmad opened this issue 6 years ago • 11 comments

Hello Everyone, I'm facing this error right now..

INFO:niftynet: Restoring parameters from model17/msnet_en32sg_20000.ckpt INFO:niftynet: Restoring parameters from model17/msnet_en32cr_20000.ckpt Data load, 100.0% finished ** ERROR (nifti_image_write_hdr_img2): cannot open output file '/result17/HGG/Brats17_CBICA_ATX_1.nii.gz' HGG/Brats17_CBICA_ATX_1 ** ERROR (nifti_image_write_hdr_img2): cannot open output file '/result17/HGG/Brats17_CBICA_AXN_1.nii.gz' HGG/Brats17_CBICA_AXN_1 test time 124.04104340076447 Traceback (most recent call last): File "test.py", line 460, in test(config_file) File "test.py", line 450, in test np.savetxt(save_folder + '/test_time.txt', test_time) File "/home/zaaba/anaconda3/lib/python3.6/site-packages/numpy/lib/npyio.py", line 1307, in savetxt open(fname, 'wt').close() FileNotFoundError: [Errno 2] No such file or directory: '/result17/test_time.txt'

Sorry if this error is a newbie mistake... :(

zaabahmad avatar Oct 13 '18 08:10 zaabahmad

Changes that i make is on the data_root path and save_folder path as below...

data_root = /home/zaaba/anaconda3/brats17-master/Brats17TrainingData save_folder = /home/zaaba/anaconda3/brats17-master/Brats17TrainingData/result17 data_names = config17/test_names_temp.txt

zaabahmad avatar Oct 13 '18 09:10 zaabahmad

Hi zaabahmad, Can you make sure the output dir exists? You need to create that dir manually as the code does not create it automatically.

taigw avatar Oct 18 '18 01:10 taigw

Hi taigw, Thank you for responding. The output dir did exists as i have manually create it. As below configuration. data_root = /home/zaaba/anaconda3/brats17-master/Brats17TrainingData save_folder = /home/zaaba/anaconda3/brats17-master/Brats17TrainingData/result17 data_names = config17/test_names_temp.txt

should i change it to this instead?

data_root = /home/zaaba/anaconda3/brats17-master/Brats17TrainingData save_folder = /home/zaaba/anaconda3/brats17-master/Brats17TrainingData/result17 data_names = /home/zaaba/anaconda3/brats17-master/config17/test_names_temp.txt

zaabahmad avatar Oct 19 '18 03:10 zaabahmad

I got the same error, if you have fixed it the bug, can you please tell me the way how to correct this error?

TigabuYaya avatar Nov 02 '18 15:11 TigabuYaya

@zaabahmad In your first question, it seems that you were trying to save the data to ''/result17". I guess you intended to save it in "./result17".

taigw avatar Dec 03 '18 08:12 taigw

@TigabuYaya Have you solved the problem?

taigw avatar Dec 03 '18 08:12 taigw

I'm having this same problem when trying to write my output data:

** ERROR (nifti_image_write_hdr_img2): cannot open output file 'result18/HGG/Brats18_CBICA_ATX_1.nii.gz'

My test_all_class.txt file reference scheme is the same as your example in config17.

fhenrywells avatar May 13 '19 22:05 fhenrywells

[Resolved]: You have to make the directory containing HGG/LGG results programmatically before writing to this directory in save_array_as_nifty_volume(..) in data_process.py

fhenrywells avatar May 14 '19 03:05 fhenrywells

For my case, there is no enough disk space.

jcai10 avatar Jul 22 '19 17:07 jcai10

For my case, there is no enough disk space.

Me Too !!

JiexiPinkman avatar May 08 '20 03:05 JiexiPinkman

You have to make the directory containing HGG/LGG results programmatically before writing to this directory in save_array_as_nifty_volume(..) in data_process.py

how? help please

Andrescmm avatar Nov 23 '22 07:11 Andrescmm