Hello there,
I've ran function hounsfield2density on a nifti file but this error keeps coming up. Here is the error log.
>> whos nifti_file
Name Size Bytes Class Attributes
nifti_file 260x311x260 42047200 int16
>> nifti_test01
Error using zeros
Input following 'like' is not a numeric or logical array.
Error in hounsfield2density (line 59)
density = zeros(size(ct_data), 'like', ct_data);
Error in nifti_test01 (line 3)
[density, sound_speed] = hounsfield2density('nifti_file');
This is the code I used.
nifti_file = niftiread('att_map.nii');
niftiinfo('t1w_pct.nii');
%% Create the computational grid
Nx = 400;
Ny = 400;
Nz = 400;
dx = 50e-6;
dy = 50e-6;
dz = 50e-6;
kgrid = makeGrid(Nx, dx, Ny, dy, Nz, dz);
%% Define medium properties (using hounsfield2density
density = hounsfield2density(nifti_file);
Any suggestion as to what I should do?