forked from smshah87/3D-Barcoding-Spots-Code-GIT
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathalltforms3D.m
49 lines (43 loc) · 1.42 KB
/
alltforms3D.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
function [tforms] = alltforms3D(PathName,colors,channels,reference)
% colors = # of channels in stack minus DAPI
% channels = channels numbers that need to be aligned
% reference = number of reference channel
fld = pwd;
Miji;
cd(fld);
if isempty(PathName)
[FileName,PathName,FilterIndex] = uigetfile('.tif');
path_to_fish = ['path=[' PathName FileName ']'];
else
path_to_fish = ['path=[' PathName ']'];
C = strsplit(PathName,'\');
FileName = C{end};
k = strfind(PathName,'\');
PathName = PathName(1:k(end)-1);
end
MIJ.run('Open...', path_to_fish);
%range = inputdlg('Where Should I Start In Z');
%MIJ.run('Z Project...', 'projection=[Max Intensity]');
%MIJ.run('Subtract Background...', 'rolling=10 stack');
MIJ.run('Split Channels');
mkdir([PathName 'channelsWBG']);
for i = 1:colors
%name = ['C' num2str(i) '-MAX_' FileName];
name = ['C' num2str(i) '-' FileName];
Images = uint16(MIJ.getImage(name));
saveastiff(Images, [PathName 'channelsWBG\channel' num2str(i) '.tif'])
end
MIJ.run('Close All');
MIJ.exit;
for i = 1:colors
tforms{i} = [];
end
for i = 1:length(channels)
[tforms{i}] = findtformV3([PathName 'channelsWBG\channel' num2str(channels(i)) '.tif'],[PathName 'channelsWBG\channel' num2str(reference) '.tif'],num2str(channels(i)));
pause('on');
pause;
close all;
% MIJ.run('Close All');
% MIJ.exit
end
tforms(cellfun(@isempty,tforms)) = tforms(reference);