Permalink
Browse files

simulate mirrored image

  • Loading branch information...
Jonas
Jonas committed Nov 17, 2017
1 parent 0a74324 commit bcc4effc2cb8ac7edf4af939b983b27defbd9a82
Showing with 35 additions and 7 deletions.
  1. +14 −2 private/getstackcal_g.m
  2. +8 −2 private/images2beads_globalfit.m
  3. +13 −3 simulate2c.m
View
@@ -29,13 +29,21 @@
allstacks=zeros(sstack(1),sstack(2),sstack(3),length(beads))+NaN;
allstackst=zeros(sstack(1),sstack(2),sstack(3),length(beads))+NaN;
% allstackstm=zeros(sstack(1),sstack(2),sstack(3),length(beads))+NaN;
goodvs=[];
for B=length(beads):-1:1
allstacks(:,:,:,B)=beads(B).stack.image;
allstackst(:,:,:,B)=beads(B).stack.imagetar;
if ~p.mirror
allstackst(:,:,:,B)=beads(B).stack.imagetar;
shiftxy(B,1:2)=beads(B).shiftxy;
else
allstackst(:,:,:,B)=beads(B).stack.imagetar(end:-1:1,:,:);
shiftxy(B,1:2)=beads(B).shiftxy;
shiftxy(B,2)=-shiftxy(B,2);
end
stackh=allstacks(:,:,:,B);
goodvs(B)=sum(~isnan(stackh(:)))/numel(stackh);
shiftxy(B,1:2)=beads(B).shiftxy;
end
mstack=nanmean(allstacks,4);
@@ -94,6 +102,10 @@
corrPSFr=corrPSF(1:size(allrois,1),:,:);
corrPSFt=corrPSF(size(allrois,1)+1:end,:,:);
if p.mirror
corrPSFt=corrPSFt(end:-1:1,:,:);
end
%undo sorting by deviation to associate beads again to their
%bead number
[~,sortback]=sort(sortinddev);
@@ -10,6 +10,9 @@
b=[];
ht=uitab(p.tabgroup,'Title','Files');
tg=uitabgroup(ht);
l=load(p.Tfile);
transform=l.transformation;
p.mirror=contains(transform.tinfo.mirror.targetmirror,'up-down');
for k=1:length(filelist)
ax=axes(uitab(tg,'Title',num2str(k)));
p.fileax(k)=ax;
@@ -25,8 +28,12 @@
imstack=readfile_tif(filelist{k});
end
imstack=imstack-min(imstack(:)); %fast fix for offset;
% imageslicer(imstack)%%%%%%%%XXXXXXX
mim=max(imstack,[],3);
mim=filter2(h,mim);
imagesc(ax,mim);
@@ -62,8 +69,7 @@
maximanm(:,2)=maximanm(:,2)*p.smappos.pixelsize{k}(end)*1000;
%transform reference to target
l=load(p.Tfile);
transform=l.transformation;
indref=transform.getRef(maximanm(:,1),maximanm(:,2));
maximaref=maxima(indref,:);
[x,y]=transform.transformCoordinatesFwd(maximanm(indref,1),maximanm(indref,2));
View
@@ -3,14 +3,17 @@
cal3dfile='/Users/jonas/Documents/Data/ROI2_20per639_50msexp_1/ROI2_20per639_50msexp_1_3dcal.mat';
% transformfile='/Users/jonas/Documents/Data/ROI2_20per639_50msexp_1/simulstack_affine_2_T.mat';
transformfile='/Users/jonas/Documents/Data/ROI2_20per639_50msexp_1/affine_T.mat';
% transformfile='/Users/jonas/Documents/Data/ROI2_20per639_50msexp_1/testmirrorA_T.mat';
% cal3dfile='/Users/ries/Documents/Data/3D/global3D/ROI2_20per639_50msexp_1_3dcal.mat';
% transformfile='/Users/ries/Documents/Data/3D/global3D/ROI2_20per639_50msexp_1/ROI2_20per639_50msexp_1_MMStack_T.mat';
mirror=true;
midp=255;
nbeads=25;
roisize=31;
dr=(roisize-1)/2;
zpos=1:201; %in slices
% zpos=99:101;
pixelsize=100;
Nphot=16000;
Nbg=5;
@@ -41,11 +44,18 @@
channel=2;
makeimg
img=img+Nbg;
if mirror
img(midp:end,:,:)=img(end:-1:midp,:,:);
end
imageslicer(img);
imgnoise=poissrnd(img);
outfile=[fileparts(cal3dfile) filesep 'simulstack.tif'];
outfile2=[fileparts(cal3dfile) filesep 'simulstackp.tif'];
outfile=[fileparts(cal3dfile) filesep 'simulstackM.tif'];
outfile2=[fileparts(cal3dfile) filesep 'simulstackMp.tif'];
% imgnoise=permute(imgnoise,[2,1,3]);
saveastiff(uint16(imgnoise),outfile);
saveastiff(uint16(img+Nbg),outfile2);

0 comments on commit bcc4eff

Please sign in to comment.