-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #13 from zengjiexia/SR-analysis-development
Super resolution image analysis development
- Loading branch information
Showing
63 changed files
with
6,176 additions
and
746 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file renamed
BIN
+114 KB
....app/jars/imglib2-realtransform-3.0.0.jar → ....app/jars/imglib2-realtransform-3.1.0.jar
100755 → 100644
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file renamed
BIN
+50.4 KB
Fiji.app/jars/n5-2.4.0.jar → Fiji.app/jars/n5-2.5.0.jar
100755 → 100644
Binary file not shown.
Binary file renamed
BIN
+16.8 KB
Fiji.app/jars/n5-google-cloud-3.3.1.jar → Fiji.app/jars/n5-google-cloud-3.3.2.jar
100755 → 100644
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file renamed
BIN
+942 KB
Fiji.app/jars/scifio-0.41.0.jar → Fiji.app/jars/scifio-0.42.0.jar
100755 → 100644
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file renamed
BIN
+1.38 MB
Fiji.app/plugins/TrackMate_-6.0.2.jar → Fiji.app/plugins/TrackMate_-6.0.3.jar
100755 → 100644
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
function [ im ] = BinLocalizations( positions, imsize, zoomfactor ) | ||
|
||
% Offset and rescale positions | ||
positions = single(positions); | ||
positions = positions*zoomfactor; | ||
%positions = positions + 0.5; | ||
|
||
% Filter localizations outside the FOV | ||
binimsize = ceil(imsize*zoomfactor); | ||
keep = positions(:,1)>=0; | ||
keep = keep & positions(:,2)>=0; | ||
keep = keep & positions(:,1)<=binimsize; | ||
keep = keep & positions(:,2)<=binimsize; | ||
positions = positions(keep,:); | ||
|
||
% Bin localizations | ||
im = zeros(binimsize,binimsize); | ||
for i = 1:size(positions,1) | ||
x = round(positions(i,1)); | ||
y = round(positions(i,2)); | ||
if x==0 | ||
x=x+1; | ||
end | ||
if y==0 | ||
y=y+1; | ||
end | ||
im(y,x) = im(y,x)+1; | ||
end | ||
|
||
end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
function [ corr ] = CrossCorrelation( image1, image2 ) | ||
|
||
corr = fftshift( real( ifft2(fft2(image1).*conj(fft2(image2))) ) ); | ||
|
||
end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
% ------------------------------------------------------------------------- | ||
% Matlab version of direct cross-correlation drift correction method | ||
% Input: coords: localization coordinates [x y frame], | ||
% segpara: segmentation parameters (time wimdow, frame) | ||
% imsize: image size (pixel) | ||
% pixelsize: camera pixel size (nm) | ||
% binsize: spatial bin pixel size (nm) | ||
% Output: coordscorr: localization coordinates after correction [xc yc] | ||
% finaldrift: drift curve | ||
% By Yina Wang @ Hust 2013.10.18 | ||
% ------------------------------------------------------------------------- | ||
|
||
function [coordscorr, finaldrift] = DCC(coords, segpara, imsize, pixelsize, binsize ) | ||
|
||
zoomfactor = pixelsize / binsize; | ||
ntotalframe = max(coords(:,3)); | ||
|
||
coordscorr = zeros(size(coords,1),size(coords,2)); | ||
finaldrift = zeros(ntotalframe,2); | ||
|
||
%% bin localizations, frame shifts calculation | ||
nbinframe = floor(ntotalframe / segpara); | ||
|
||
imshift = zeros(nbinframe-1,1); | ||
fitresult = zeros(5,nbinframe-1); | ||
|
||
i=1; | ||
index = coords(:,3)>(i-1)*segpara+1 & coords(:,3)<=i*segpara; | ||
imorigin = BinLocalizations(coords(index,1:2), imsize, zoomfactor); | ||
autocorr = CrossCorrelation(imorigin,imorigin); | ||
[yorigin, xorigin] = GaussianFit(autocorr); | ||
|
||
for i = 2:nbinframe | ||
index = coords(:,3)>(i-1)*segpara+1 & coords(:,3)<=i*segpara; | ||
imbim = BinLocalizations(coords(index,1:2), imsize, zoomfactor); | ||
|
||
corr = CrossCorrelation(imorigin,imbim); | ||
[y,x] = GaussianFit(corr); | ||
imshift(i-1,1) = xorigin-x; | ||
imshift(i-1,2) = yorigin-y; | ||
end | ||
|
||
%% drift interpolation | ||
indexinterp=zeros(nbinframe+2,1); | ||
indexinterp(1)=1; | ||
indexinterp(nbinframe+2)=ntotalframe; | ||
indexinterp(2:nbinframe+1)=round(segpara/2):segpara:segpara*nbinframe-1; | ||
|
||
finaldrift(:,1) = interp1(indexinterp,[0 0 imshift(:,1)' imshift(nbinframe-1,1)],1:ntotalframe,'spline'); | ||
finaldrift(:,2) = interp1(indexinterp,[0 0 imshift(:,2)' imshift(nbinframe-1,2)],1:ntotalframe,'spline'); | ||
finaldrift = finaldrift./zoomfactor; | ||
|
||
for i = 1:ntotalframe | ||
index = find(coords(:,3)==i); | ||
coordscorr(index,1) = coords(index,1)-finaldrift(i,1); | ||
coordscorr(index,2) = coords(index,2)-finaldrift(i,2); | ||
end | ||
coordscorr(:,3) = coords(:,3); | ||
|
||
end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
function [ guess ] = FitInitialGuess( corrfunc, peakfindsize ) | ||
|
||
n = size(corrfunc,1)/2; | ||
|
||
[y, x] = ZeroPaddingFFT(corrfunc,peakfindsize,10); | ||
guess(4)=int16(ceil(y)); | ||
guess(3)=int16(ceil(x)); | ||
|
||
guess(1)=corrfunc(guess(4),guess(3)); | ||
guess(5) = mean(mean(corrfunc)); % background | ||
cropsize = 64; | ||
corr = corrfunc(guess(4)-cropsize/2+1:guess(4)+cropsize/2,guess(3)-cropsize/2+1:guess(3)+cropsize/2); | ||
[Wy, Wx] = find( ismember( abs((corr./double(guess(1)) - exp(-1))), min(min(abs(corr./double(guess(1)) - exp(-1)))) ) ); | ||
Wx = mod(Wx,size(corr,2)); | ||
guess(2) = mean(( (Wx - cropsize/2 ).^2 + (Wy - cropsize/2 ).^2 ).^(1/2)); | ||
if(guess(2)<1 || guess(2)>10) | ||
guess(2) = 5; | ||
end | ||
|
||
guess=double(guess); | ||
end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
function [ y, x ] = GaussianFit( corrfunc ) | ||
|
||
[ guess ] = FitInitialGuess( corrfunc, 48 ); | ||
|
||
radiu = round( 2.5 * guess(2) ); | ||
originy = guess(4); | ||
originx = guess(3); | ||
fitdata = corrfunc(originy-radiu:originy+radiu,originx-radiu:originx+radiu); | ||
[X,Y] = meshgrid(1:1:size(fitdata,2),1:1:size(fitdata,1)); | ||
grid = [X Y]; | ||
|
||
xoffset = guess(3) - radiu - 1; | ||
yoffset = guess(4) - radiu - 1; | ||
guess(3) = radiu + 1; | ||
guess(4) = radiu + 1; | ||
[opt,norm] = lsqcurvefit(@gaussmodel2dwxy, guess, grid, fitdata); | ||
|
||
x = opt(3) + xoffset; | ||
y = opt(4) + yoffset; | ||
end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
|
||
% ------------------------------------------------------------------------- | ||
% Matlab version of Mean cross-correction method of OE2012 paper | ||
% Input: coords: localization coordinates [x y frame], | ||
% segpara: segmentation parameters (time wimdow, frame) | ||
% imsize: image size (pixel) | ||
% pixelsize: camera pixel size (nm) | ||
% binsize: spatial bin pixel size (nm) | ||
% Output: coordscorr: localization coordinates after correction [xc yc] | ||
% finaldrift: drift curve (save b matrix for other analysis) | ||
% By Yina Wang @ Hust 2013.10.21 | ||
% ------------------------------------------------------------------------- | ||
|
||
function [coordscorr, finaldrift, bsave] = MCC(coords, segpara, imsize, pixelsize, binsize ) | ||
|
||
zoomfactor = pixelsize / binsize; | ||
ntotalframe = max(coords(:,3)); | ||
|
||
coordscorr = zeros(size(coords,1),size(coords,2)); | ||
finaldrift = zeros(ntotalframe,2); | ||
|
||
%% bin localizations, frame to frame drift calculation | ||
nbinframe = floor(ntotalframe / segpara); | ||
|
||
imshift = zeros(nbinframe * (nbinframe - 1)/2,2); % shifts between any two bin steps in x and y direction | ||
drift=zeros(nbinframe,2); | ||
|
||
flag=1; | ||
for i = 1:nbinframe-1 | ||
index = coords(:,3)>(i-1)*segpara+1 & coords(:,3)<=i*segpara; | ||
imorigin = BinLocalizations(coords(index,1:2), imsize, zoomfactor); | ||
autocorr = CrossCorrelation(imorigin,imorigin); | ||
[yorigin, xorigin] = GaussianFit(autocorr); | ||
|
||
for j = i+1:nbinframe | ||
index = coords(:,3)>(j-1)*segpara+1 & coords(:,3)<=j*segpara; | ||
imbin = BinLocalizations(coords(index,1:2), imsize, zoomfactor); | ||
corr = CrossCorrelation(imorigin,imbin); | ||
[y,x] = GaussianFit(corr); | ||
|
||
imshift(flag,1) = xorigin-x; | ||
imshift(flag,2) = yorigin-y; | ||
drift(i,1)=drift(i,1)-imshift(flag,1); | ||
drift(i,2)=drift(i,2)-imshift(flag,2); | ||
flag=flag+1; | ||
end | ||
|
||
clear index | ||
for j = 1:i-1 | ||
index=(nbinframe-1)*(j-1)-(j-2)*(j-1)/2-j+i; | ||
drift(i,1)=drift(i,1)+imshift(index,1); | ||
drift(i,2)=drift(i,2)+imshift(index,2); | ||
end | ||
end | ||
for j = 1:nbinframe-1 | ||
index=(nbinframe-1)*(j-1)-(j-2)*(j-1)/2-j+nbinframe; | ||
drift(nbinframe,1)=drift(nbinframe,1)+imshift(index,1); | ||
drift(nbinframe,2)=drift(nbinframe,2)+imshift(index,2); | ||
end | ||
drift=drift./nbinframe; | ||
|
||
%% save results | ||
bsave=imshift; | ||
|
||
%% drift interpolation | ||
indexinterp=zeros(nbinframe+2,1); | ||
indexinterp(1)=1; | ||
indexinterp(nbinframe+2)=ntotalframe; | ||
indexinterp(2:nbinframe+1)=round(segpara/2):segpara:segpara*nbinframe-1; | ||
|
||
drift(:,1)=drift(:,1)-drift(1,1); | ||
drift(:,2)=drift(:,2)-drift(1,2); | ||
finaldrift(:,1) = interp1(indexinterp,[0 drift(:,1)' drift(nbinframe,1)],1:ntotalframe,'spline'); | ||
finaldrift(:,2) = interp1(indexinterp,[0 drift(:,2)' drift(nbinframe,2)],1:ntotalframe,'spline'); | ||
finaldrift = finaldrift./zoomfactor; | ||
|
||
for i = 1:ntotalframe | ||
index = find(coords(:,3)==i); | ||
coordscorr(index,1) = coords(index,1)-finaldrift(i,1); | ||
coordscorr(index,2) = coords(index,2)-finaldrift(i,2); | ||
end | ||
coordscorr(:,3) = coords(:,3); | ||
|
||
end |
Oops, something went wrong.