-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathrunUSignal3DmeshSurface.m
166 lines (156 loc) · 7.22 KB
/
runUSignal3DmeshSurface.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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
function runUSignal3DmeshSurface()
%
% Copyright (C) 2023, Danuser Lab - UTSouthwestern
%
% This file is part of uSignal3DPackage.
%
% uSignal3DPackage is free software: you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
% the Free Software Foundation, either version 3 of the License, or
% (at your option) any later version.
%
% uSignal3DPackage is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% GNU General Public License for more details.
%
% You should have received a copy of the GNU General Public License
% along with uSignal3DPackage. If not, see <http://www.gnu.org/licenses/>.
%
%
%imageDirectory is for raw data
imageDirectory = '/Downloads/uSignal3DExamplesData/Example2/testData';
saveDirectory = '/Downloads/uSignal3DExamplesData/Example2/analysis';
% meshDirectory = ''; % in this example mesh is saved in imageDirectory for
% each cell individually
imageList=[1];
%mesh name, mesh saved in another package as ply or obj and here is the
%input
meshFilename = 'surfacemesh.obj';
% meshFilename = 'surfacemesh.obj'; %
% set the parameters
pixelSizeXY=160.0990; %PI3K data
pixelSizeZ=160;
timeInterval=1;
%% run for each cell
for iCell=1:length(imageList)
disp(['--------- Analysing Cell ' num2str(imageList(iCell))])
imageName='1_CH00_000000.tif';
%% phase1 >> create the mesh (from u-shape3D) first 4 processes
% define the MD
%case 1 - when I have two channels
BFDataPath = [imageDirectory filesep 'Cell' num2str(imageList(iCell)) filesep imageName];
ResultPath = [saveDirectory filesep 'Cell' num2str(imageList(iCell))];
if ~isdir(ResultPath) mkdir(ResultPath); end
MD = MovieData(BFDataPath, ResultPath);
% case2 - for oneChannel folder
% imagePathCell = fullfile(imageDirectory,['Cell' num2str(imageList(iCell))]);
% savePathCell = fullfile(saveDirectory, ['Cell' num2str(imageList(iCell))]);
% MD = makeMovieDataOneChannel(imagePathCell, savePathCell, pixelSizeXY, pixelSizeZ, timeInterval);
% add a package
MD.addPackage(uSignal3DPackage(MD)); % only for Initail script
%skip the first two processes because mesh has been created before
%% Process 1: Deconvolution3DProcess
% % disp('===================================================================');
% % disp('Running (1st) Deconvolution');
% % disp('===================================================================');
% % iPack = 1;
% % step_ = 1;
% % MD.getPackage(iPack).createDefaultProcess(step_)
% % params = MD.getPackage(iPack).getProcess(step_).funParams_;
% % params.deconMode = 'richLucy'; % Edit process parameter, tightness, from 0.5 to 0.6
% % params.richLucyIter = 8;
% % params.apoHeight=0;
% % params.pathApoPSF = pathPSF;
% % params.pathDeconPSF = pathPSF;
% % params.ChannelIndex = 1; %analyze only channel1
% % MD.getPackage(iPack).getProcess(step_).setPara(params);
% % MD.save;
% % params = MD.getPackage(iPack).getProcess(step_).funParams_
% % MD.getPackage(iPack).getProcess(step_).run();
% %
% %
% % %% Process 2: ComputeMIPProcess
% % disp('===================================================================');
% % disp('Running (2nd) Maximum Intensity Projection (MIP)');
% % disp('===================================================================');
% % iPack = 1;
% % step_ = 2;
% % MD.getPackage(iPack).createDefaultProcess(step_)
% % params = MD.getPackage(iPack).getProcess(step_).funParams_;
% % params.ChannelIndex = 1; %analyze only channel1
% % MD.getPackage(iPack).getProcess(step_).setPara(params);
% % MD.save;
% % params = MD.getPackage(iPack).getProcess(step_).funParams_
% % MD.getPackage(iPack).getProcess(step_).run();
% %
% %
%% Process 3: Mesh3DProcess
% we still need to run the mesh process to save the mesh as in input for
% the next processes
disp('===================================================================');
disp('Running (3rd) Creating Mesh Surface');
disp('===================================================================');
iPack = 1;
step_ = 3;
MD.getPackage(iPack).createDefaultProcess(step_)
params = MD.getPackage(iPack).getProcess(step_).funParams_;
% params.smoothMeshMode = 'curvature';
params.scaleOtsu = 1;
% params.imageGamma = 0.7;
params.smoothImageSize = 1.5;
% params.insideErodeRadius = 7;
params.meshMode ='readObjFile'; % for obj file use 'readObjFile' and params.objFilePath should be set
params.objFilePath = [imageDirectory filesep 'Cell' num2str(imageList(iCell)) filesep meshFilename];
params.useUndeconvolved = 1; % for not searching
params.removeSmallComponents = 1;
params.ChannelIndex = 1; %analyze only channel1
MD.getPackage(iPack).getProcess(step_).setPara(params);
MD.save;
params = MD.getPackage(iPack).getProcess(step_).funParams_
MD.getPackage(iPack).getProcess(step_).run();
%% Process 4: Intensity3DProcess
disp('===================================================================');
disp('Running (4th) Measuring Intensity on Vertices');
disp('===================================================================');
iPack = 1;
step_ = 4;
MD.getPackage(iPack).createDefaultProcess(step_)
params = MD.getPackage(iPack).getProcess(step_).funParams_;
params.sampleRadius = [1];
params.normInsideBackground = [0 ];
params.meanNormalization = [1 ]; %it doesn't exclude the second channel for line 273
params.intensityMode = {'intensityInsideRawVertex'};
params.ChannelIndex = 1; %analyze only channel1
MD.getPackage(iPack).getProcess(step_).setPara(params);
MD.save;
params = MD.getPackage(iPack).getProcess(step_).funParams_
MD.getPackage(iPack).getProcess(step_).run();
%% Process 5: LaplaceBeltrami3DProcess
disp('===================================================================');
disp('Running (5th) Computing Laplace-Beltrami Operator on Vertices');
disp('===================================================================');
iPack = 1;
step_ = 5;
MD.getPackage(iPack).createDefaultProcess(step_)
params = MD.getPackage(iPack).getProcess(step_).funParams_;
params.ChannelIndex = 1; %analyze only channel1
params.nEigenvec = 100;
MD.getPackage(iPack).getProcess(step_).setPara(params);
MD.save;
params = MD.getPackage(iPack).getProcess(step_).funParams_
MD.getPackage(iPack).getProcess(step_).run();
%% Step 6: EnergySpectra3DProcess
disp('===================================================================');
disp('Running (6th) Calculating energy spectra');
disp('===================================================================');
iPack = 1;
step_ = 6;
MD.getPackage(iPack).createDefaultProcess(step_)
params = MD.getPackage(iPack).getProcess(step_).funParams_;
params.ChannelIndex = 1; %analyze only channel1
MD.getPackage(iPack).getProcess(step_).setPara(params);
MD.save;
params = MD.getPackage(iPack).getProcess(step_).funParams_
MD.getPackage(iPack).getProcess(step_).run();
end