This repository has been archived by the owner. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
added a script for import, alignement and export of stack data
- Loading branch information
1 parent
0e4bed4
commit c49d196
Showing
1 changed file
with
50 additions
and
0 deletions.
There are no files selected for viewing
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,50 @@ | ||
%% Paramters | ||
%input file | ||
inFileGren = 'D:\data\BelenTestData\Out\complete_g.tif'; | ||
inFileRed = 'D:\data\BelenTestData\Out\complete_g.tif'; | ||
|
||
%oiutput file | ||
outFileGreen = 'D:\data\BelenTestData\Out\complete_g_Grealigned.tif'; | ||
outFileRed = 'D:\data\BelenTestData\Out\complete_g_Rrealigned.tif'; | ||
|
||
%Apply Gaussian Filter before correction? | ||
bGaussian = 0; | ||
|
||
%reference channels | ||
referenceChannel = 1; %1: red, 0: green | ||
numShiftCorrections = 1; | ||
|
||
nSubIm = 200;%number of subImages for med align | ||
numImages = 50; %number of images that will be meaned for global shift correction | ||
%% Load data and perform correction | ||
data_r = loadtiff(inFileRed); | ||
data_g = loadtiff(inFileGren); | ||
|
||
for j = 1:numShiftCorrections | ||
if referenceChannel | ||
referenceChannelData = data_r; | ||
else | ||
referenceChannelData = data_g; | ||
end | ||
|
||
if bGaussian | ||
for f=1:size(referenceChannelData,3) | ||
referenceChannelData(:,:,f) = imgaussfilt(referenceChannelData(:,:,f),2); | ||
end | ||
end | ||
|
||
%Med Align | ||
[rs, cs] = medAlign(referenceChannelData, nSubIm, 50, -inf); | ||
%shift red and green channel | ||
%waitbar(j/numShiftCorrections, wb, 'Performing Med Align..'); | ||
for i = 1:size(data_g,3) | ||
data_r(:,:,i) = circshift(data_r(:,:,i),[rs(i),cs(i)]); | ||
data_g(:,:,i) = circshift(data_g(:,:,i),[rs(i),cs(i)]); | ||
end | ||
end | ||
|
||
%% Exort Data | ||
|
||
saveastiff(data_r, outFileRed); | ||
saveastiff(data_g, outFileGreen); | ||
|