I have a CT dicom files (512*512*263), I wanted to play with the CT numbers (HU) in the following way: (a) multiply the voxels that have CT number less than 20 by 2 (say, for fun, I want to understand how this works) and (b) multiply the voxels that have CT numbers greater than 20 by 10. I wrote the following code, find below.

In the code I splitted the CT_number into two parts and worked on it, now I want to combine the results such that the new column vector 1D will have the updated values. How can I do that? Shouldn't be hard I guess, but I lost. ANy help would be helpful.

CT_matrix = zeros(512, 512, 263);

info_ct = dicominfo('...01.IMA');

for p = 1:263

CTfilename = sprintf('..-%03d.IMA', p);

CT_matrix(:,:,p) = dicomread(CTfilename);

end

idx = CT_matrix(:);

CT_number = idx ;

voxels_have_CT_number_less_than_20 = CT_number(CT_number < 20);

new_voxels_have_CT_number_less_than_20 = voxels_have_CT_number_less_than_20 * 2;

voxels_have_CT_number_greater_than_20 = CT_number(CT_number > 20);

new_voxels_have_CT_number_greater_than_20 = voxels_have_CT_number_greater_than_20 * 10;

new_CT_map = reshape(.., size(CT_matrix));