• 大小: 4KB
    文件类型: .m
    金币: 1
    下载: 0 次
    发布日期: 2021-06-08
  • 语言: Matlab
  • 标签:

资源简介

SIM显微镜重建原理的matlab源文件

资源截图

代码片段和文件信息

%a program for simple SIM
clear all
close all;

%initial image
im=imread(‘E:\gradu\lena.png‘);
inm=im(1+100:256+1001+100:256+100);
inm=im2double(inm);
finm=fft2(inm);
finm=fftshift(finm);
% finm=ifft2(finm);
afinm=abs(finm);
% figure;
% imshow(afinm);
% imshow(afinm/max(max(afinm)));

%blurred image
psf=fspecial(‘gaussian‘[256256]3);
bim=imfilter(inmpsf‘same‘);   %blurred image
figure;
imshow(bim);
otf=fft2(psf);
otf=fftshift(otf);
otf=abs(otf);
% figure;
% imshow(otf);

fbim=fft2(bim);
fbim=fftshift(fbim);
afbim=abs(fbim); %the abs of fbim
% figure;
% imshow(afbim);
% imshow(afbim/max(max(afbim)));

% structured illumination
k0=1;
fi=0;
 for ii=1:256
     for jj=1:256
         i1(iijj)=1+0.5*cos(k0*jj+fi);
         i2(iijj)=1+0.5*cos(k0*jj+1/3*pi);
         i3(iijj)=1+0.5*cos(k0*jj+2/3*pi);
     end
 end
%  fi=fft2(i1);
%  fi=fftshift(fi);
%  afi=abs(fi);
%  
%  figure;
%  imshow(afi/max(max(afi)))
%  figure;
%  imshow(i1);
%  figure;
%  imshow(i2);
%  figure;
%  imshow(i3);

%detected images under structured illumination
d1=imfilter(inm.*i1psf‘same‘);
d2=imfilter(inm.*i2psf‘same‘);
d3=imfilter(inm.*i3psf‘same‘);
% figure;
% imshow(d1);
% figure;
% imshow(d2);
% figure;
% imshow(d3);

%reconstruction

fd1=fft2(d1);
fd2=fft2(d2);
fd3=fft2(d3);
fd1=fftshift(fd1);
fd2=fftshift(fd2);
fd3=fftshift(fd3);

% afd1=abs(fd1);
% afd2=abs(fd2);
% afd3=abs(fd3);
% figure;
% imshow(afd1);
% title(‘fourier detection1‘);
% figure;
% imshow(afd2);
% title(‘fourier detection2‘);
% figure;
% imshow(afd3);
% title(‘fourier detection3‘);


m=[10.50.5;10.5*exp(i*pi/3)0.5*exp(-i*pi/3);10.5*exp(i*pi*2/3)0.5*exp(-i*pi*2/3)];
m1=inv(m);
for ii=1:256
    for jj=1:256
      s11(iijj)=m1(1:)*([fd1(iijj)fd2(iijj)fd3(iijj)]‘);
      s12(iijj)=m1(2:)*([fd1(iijj)fd2(iijj)fd3(iijj)]‘);
      s13(iijj)=m1(3:)*([fd1(iijj)fd2(iijj)fd3(iijj)]‘);
    end
end
figure;
imshow(abs(s11));
figure;
imshow(abs(s12));
figure;
imshow(abs(s13));

%2nd direction
% structured il

评论

共有 条评论

相关资源