0

So I'm doing some pixelvalue comparison, and I have trouble looping some stuff. I'm gonna do some X-ray reconstruction in 128 energychannels, but I'm only able to analyse 8 channels at a time.

sinogram_data=sinogram_data(1:8,:,:,:);
images = perform_reconstruction_all_energy(sinogram_data, geostruct, reconst_param, ART_param, version_id);
save_image_data(images, dataset_path);

I want the code to loop here, so i get 16 images/sinograms with 1:8, 9:15 and so on. Something like:

for i = 1:8:120
sinogram_data(i)=sinogram_data(i:i+7,:,:,:);

I get this error wwhen I try my best

Unable to perform assignment because the size of the left side is 1-by-350-by-350 and the size of the right side is 350-by-350-by-8

Hope someone can help me. Thanks in advance!

Oliver
  • 1
  • 1

1 Answers1

0
for i=1:8:128
    current_sinogram_data=sinogram_data(i:i+7,:,:,:);
    images = perform_reconstruction_all_energy(current_sinogram_data, geostruct, reconst_param, ART_param, version_id);
    save_image_data(images, dataset_path); % change the dataset_path during for-loop
end

You must change the dataset_path during for-loop, otherwise the image data will always be overwrited.

yj_zhou
  • 11
  • 2