Download presentation
Presentation is loading. Please wait.
1
第十单元 第4课 实验 2017年全国大学生 数学建模竞赛A题
2
问题三的代码: function[attach5_reconstruct256,attach4_absorb10]=problem3(input_args) %1.对有偏移的CT投影进行校准 alpha=atan(-x0/y0)*180/pi; reconstruct_radon=zeros(size(attach5_radon)); figure; for i=1:180 theta=(i-1)*delta_angle; attach5_radon_anglei=find(abs(direction180-theta)<delta_angle/2); if isempty(attach5_radon_anglei) attach5_radon_anglei=find(abs(direction theta)<delta_angle/2); end if theta<start_angle-delta_angle reconstruct_radon(:,i)=flipud(attach5_radon(:,attach5_radon_anglei)); else reconstruct_radon(:,i)=attach5_radon(:,attach5_radon_anglei);
3
end if abs(theta)<delta_angle d=abs(x0); elseif abs(theta-180)<delta_angle%k=0,水平方向投影 d=y0; else k=tan(theta*pi/180+pi/2); d=abs(-k*x0+y0)/sqrt(1+k^2); end address_num=round(d/sepdist); if address_num>0 if theta<=alpha | theta>180+alpha reconstruct_radon(:,i)=[reconstruct_radon(address_num+1:end,i);zeros(address_num,1)]; else reconstruct_radon(:,i)=[zeros(address_num,1);reconstruct_radon(1:end-address_num,i)]; end
4
plot([1:N],reconstruct_radon(:,i));
hold on; end grid on; xlabel('投影地址'); ylabel('投影值'); title(sprintf('重新校准之后的附件5的各方向投影')); saveas(gcf,sprintf('重新校准之后的附件5的各方向投影'),'jpg'); %2.根据投影校准之后的reconstruct_radon利用iradon反变换重构附件5的原图像 attach5_reconstruct362=iradon(reconstruct_radon,theta180); imwrite(attach5_reconstruct362,'重构附件5的362X362图像.jpg','jpg'); attach5_reconstruct256=imresize(attach5_reconstruct362,[ ]);
5
[row,col]=find(attach5_reconstruct256<0);
for i=1:length(row) attach5_reconstruct256(row(i),col(i))=0; end figure;imshow(attach5_reconstruct256,[]);title('重构附件5的256X256图像'); imwrite(attach5_reconstruct256,'重构附件5的256X256图像.jpg','jpg'); xlswrite('problem3.xls',attach5_reconstruct256); %3.重构附件5的吸收率图像中由附件4中指定的10个位置处的吸收率 r=1; attach4_10pos_pixel=round(attach4_10pos*256/100); t=attach4_10pos_pixel(:,2); attach4_10pos_pixel(:,2)=attach4_10pos_pixel(:,1); attach4_10pos_pixel(:,1)=256-t; for i=1:size(attach4_10pos_pixel,1) attach4_absorb10(i,1)=gain*mean(mean(attach5_reconstruct256...
6
(attach4_10pos_pixel(i,1)-r:attach4_10pos_pixel(i,1)+r,attach4_10pos_pixel(i,2)-r:attach4_10pos_pixel(i,2)+r))); end attach4_absorb10=abs(attach4_absorb10); xlswrite('附件4指定的10个位置处的吸收率.xls',attach4_absorb10);
Similar presentations