0

所以我正在做一些像素值比较,我在循环一些东西时遇到了麻烦。我将在 128 个能量通道中进行一些 X 射线重建,但我一次只能分析 8 个通道。

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);

我希望代码在这里循环,所以我得到 16 个图像/正弦图,1:8、9:15 等等。就像是:

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

当我尽力而为时出现此错误

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

希望可以有人帮帮我。提前致谢!

4

1 回答 1

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

你必须在 for 循环期间更改 dataset_path,否则图像数据将始终被覆盖。

于 2020-06-23T01:08:06.833 回答