ValueError: cannot reshape array of size 634880 into shape (256,256,120)
Opened this issue · 1 comments
I utilized the keaDataProcessing.py
provided with the Axial 10 days dataset in the Code
folder to overcome one of the issues I raised before about that module not being found.
Then, I set up the paths in the LFsim/LF_sim_NHP_v5.py
file as follows;
image_path_HF = r"/content/high_field_data/IXI016-Guys-0697-IXIT2WTS_-s231_-0401-00004-000002-02.nii"
LF_sim_saving_path = r"/content/lf_simulated_data"
image_path_LF = r"/content/drive/MyDrive/Axial_10days/Day1_01032023/Session1_11AM/3DTSE/1/data.3d"
acqu_path = r"/content/drive/MyDrive/Axial_10days/Day1_01032023/Session1_11AM/3DTSE/1/acqu.par"
noise_path = r"/content/drive/MyDrive/Axial_10days/Day1_01032023/Session1_11AM/3DTSE/1"
The high field image I'm using is from the IXI dataset (1 nifti file). The low field image I'm using is from the Axial_10 dataset. These can be deduced from the paths above. The axial 10 dataset is in volumes of 155x155x25
whereas the IXI dataset is in shapes of 256x256x120
.
When I then run the LFsim/LF_sim_NHP_v5.py
, it throws this error
Traceback (most recent call last):
File "/content/LFsim/LF_sim_NHP_v5.py", line 307, in <module>
LF_acq_noise_patch = get_noise(LF_sim, LF_noise_matrix, noise_fact)
File "/content/LFsim/LF_simulation_functions.py", line 191, in get_noise
LF_noise_use = np.reshape(LF_noise_use, (x,y,z))
File "<__array_function__ internals>", line 180, in reshape
File "/usr/local/lib/python3.10/dist-packages/numpy/core/fromnumeric.py", line 298, in reshape
return _wrapfunc(a, 'reshape', newshape, order=order)
File "/usr/local/lib/python3.10/dist-packages/numpy/core/fromnumeric.py", line 57, in _wrapfunc
return bound(*args, **kwds)
ValueError: cannot reshape array of size 634880 into shape (256,256,120)
I think this error arises from the difference in shapes between the IXI dataset and the Axial 10 dataset.
This error came to me before as well. But then I realized that my numpy library still needed to be updated. When I did it, this error was gone. So you might have the same problem. Try updating your Numpy library.