make_intermediate_results_from_temp_folder (1 call, 8.722 sec)
Generated 05-Nov-2014 07:52:30 using cpu time.
function in file /usr0/home/jenkins/workspace/cellorganizer-demo3D11-glnx64/utilities/make_intermediate_results_from_temp_folder.m
Copy to new window for comparing multiple runs
Function Name | Function Type | Calls |
img2slml | function | 1 |
Line Number | Code | Calls | Total Time | % Time | Time Plot |
236 | save( output_file, 'cell_param... | 202 | 5.598 s | 64.2% | ![]() |
111 | cell_param = load( temporary_f... | 202 | 1.833 s | 21.0% | ![]() |
71 | cell_param.preprocessed = load... | 202 | 0.701 s | 8.0% | ![]() |
123 | cell_param.nucleus.features = ... | 202 | 0.340 s | 3.9% | ![]() |
119 | temporary_file = [ pwd filese... | 202 | 0.090 s | 1.0% | ![]() |
All other lines | 0.160 s | 1.8% | ![]() | ||
Totals | 8.722 s | 100% |
Function Name | Function Type | Calls | Total Time | % Time | Time Plot |
num2str | function | 808 | 0.100 s | 1.1% | ![]() |
filesep | function | 1218 | 0.030 s | 0.3% | ![]() |
pwd | function | 204 | 0.010 s | 0.1% | ![]() |
Self time (built-ins, overhead, etc.) | 8.582 s | 98.4% | ![]() | ||
Totals | 8.722 s | 100% |
Line number | Message |
54 | EXIST with two input arguments is generally faster and clearer than with one input argument. |
72 | Best practice is for CATCH to be followed by an identifier that gets the error information. |
73 | The first argument of WARNING should be a message identifier. Using a message identifier allows users better control over the message. |
85 | EXIST with two input arguments is generally faster and clearer than with one input argument. |
91 | Best practice is for CATCH to be followed by an identifier that gets the error information. |
97 | Best practice is for CATCH to be followed by an identifier that gets the error information. |
112 | Best practice is for CATCH to be followed by an identifier that gets the error information. |
113 | The first argument of WARNING should be a message identifier. Using a message identifier allows users better control over the message. |
124 | Best practice is for CATCH to be followed by an identifier that gets the error information. |
125 | The first argument of WARNING should be a message identifier. Using a message identifier allows users better control over the message. |
148 | The variable 'mixtures' appears to change size on every loop iteration. Consider preallocating for speed. |
149 | Best practice is for CATCH to be followed by an identifier that gets the error information. |
150 | The first argument of WARNING should be a message identifier. Using a message identifier allows users better control over the message. |
166 | Best practice is for CATCH to be followed by an identifier that gets the error information. |
167 | The first argument of WARNING should be a message identifier. Using a message identifier allows users better control over the message. |
178 | Best practice is for CATCH to be followed by an identifier that gets the error information. |
179 | The first argument of WARNING should be a message identifier. Using a message identifier allows users better control over the message. |
190 | Best practice is for CATCH to be followed by an identifier that gets the error information. |
191 | The first argument of WARNING should be a message identifier. Using a message identifier allows users better control over the message. |
202 | Best practice is for CATCH to be followed by an identifier that gets the error information. |
203 | The first argument of WARNING should be a message identifier. Using a message identifier allows users better control over the message. |
214 | Best practice is for CATCH to be followed by an identifier that gets the error information. |
215 | The first argument of WARNING should be a message identifier. Using a message identifier allows users better control over the message. |
226 | Best practice is for CATCH to be followed by an identifier that gets the error information. |
227 | The first argument of WARNING should be a message identifier. Using a message identifier allows users better control over the message. |
Total lines in function | 242 |
Non-code lines (comments, blank lines) | 99 |
Code lines (lines that can run) | 143 |
Code lines that did run | 53 |
Code lines that did not run | 90 |
Coverage (did run/can run) | 37.06 % |
time calls line
1 function make_intermediate_results_from_temp_folder( param )
2 %MAKE_INTERMEDIATE_RESULTS_FROM_TEMP_FOLDER Helper method that takes files
3 %from the temp folder to make the intermediate results
4
5 % Copyright (C) 2007-2013 Murphy Lab
6 % Carnegie Mellon University
7 %
8 % This program is free software; you can redistribute it and/or modify
9 % it under the terms of the GNU General Public License as published
10 % by the Free Software Foundation; either version 2 of the License,
11 % or (at your option) any later version.
12 %
13 % This program is distributed in the hope that it will be useful, but
14 % WITHOUT ANY WARRANTY; without even the implied warranty of
15 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 % General Public License for more details.
17 %
18 % You should have received a copy of the GNU General Public License
19 % along with this program; if not, write to the Free Software
20 % Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
21 % 02110-1301, USA.
22 %
23 % For additional information visit http://murphylab.web.cmu.edu or
24 % send email to murphy@cmu.edu
25
1 26 if ~isfield(param, 'verbose')
27 param.verbose = true;
28 end
29
1 30 if ~isfield(param, 'debug')
31 param.debug = true;
32 end
33
34 %temp files directories
1 35 temp_files_directory = [ pwd filesep 'temp' ];
36
1 37 if strcmpi(param.dimensionality, '2D')
38 preprocessed_files_directory = [ temp_files_directory filesep ...
39 'preprocessed' ];
40 cellcodes_directory = [ temp_files_directory filesep ...
41 'cellcodes' ];
42 protein_model_temp_files_directory = [ temp_files_directory filesep ...
43 'protein' ];
1 44 else
1 45 preprocessed_files_directory = [ temp_files_directory filesep ...
46 'preprocessing' ];
1 47 cellcodes_directory = [ temp_files_directory filesep ...
48 'cell_shape_eigen' ];
1 49 protein_model_temp_files_directory = [ temp_files_directory filesep ...
50 'protein_objects_gaussian' ];
1 51 end
52
1 53 intermediate_results_folder = [ pwd filesep 'intermediate_results' ];
1 54 if ~exist( intermediate_results_folder )
1 55 mkdir( intermediate_results_folder )
1 56 end
57
58 %get the number of files
1 59 files = dir( [ preprocessed_files_directory filesep '*.mat' ] );
60
1 61 for index=1:1:length( files )
202 62 if param.verbose && param.debug
0.04 202 63 disp( ['Building intermediate results for image: ' num2str( index )] );
202 64 tic
202 65 end
66
202 67 file = files(index).name;
68
202 69 try
0.02 202 70 temporary_filename = [ preprocessed_files_directory filesep file ];
0.70 202 71 cell_param.preprocessed = load( temporary_filename );
72 catch
73 warning( ['Unable to load: ' temporary_file ] );
74 end
202 75 clear temporary_filename
76
202 77 if strcmpi( param.train.flag, 'all' ) || strcmpi( param.train.flag, 'framework' )
0.01 202 78 if strcmpi( param.nucleus.type, 'diffeomorphic' )
79 diffeomorphic_temp_files = [ temp_files_directory ...
80 filesep 'diffeomorphic' ];
81
82 diffeomorphic_intermediate_files = [ intermediate_results_folder filesep ...
83 'diffeomorphic' ];
84
85 if ~exist( diffeomorphic_intermediate_files )
86 mkdir( diffeomorphic_intermediate_files );
87 end
88
89 try
90 copyfile( diffeomorphic_temp_files, diffeomorphic_intermediate_files );
91 catch
92 disp(['Could not copy ' diffeomorphic_temp_files ' to ' diffeomorphic_intermediate_files]);
93 end
94
95 try
96 rmdir( [ diffeomorphic_intermediate_files filesep 'distances' ], 's' );
97 catch
98 disp(['Could not remove ' diffeomorphic_intermediate_files filesep 'distances' ])
99 end
202 100 else
101
202 102 if strcmpi( param.dimensionality, '2d' )
103 temporary_file = [ cellcodes_directory filesep ...
104 'cell_' num2str(index) '.mat' ];
202 105 else
0.04 202 106 temporary_file = [ cellcodes_directory filesep ...
107 'cellcodes_' num2str(index) '.mat' ];
202 108 end
109
202 110 try
1.83 202 111 cell_param = load( temporary_file );
1 112 catch
1 113 warning( ['Unable to load: ' temporary_file ] );
1 114 end
202 115 clear temporary_file
116
117 %nuclear features
202 118 if strcmpi( param.dimensionality, '3d' )
0.09 202 119 temporary_file = [ pwd filesep 'temp' filesep ...
120 'nuclearfeats' filesep 'nuclearfeats' num2str(index) '.mat' ];
121
202 122 try
0.34 202 123 cell_param.nucleus.features = load( temporary_file );
124 catch
125 warning( ['Unable to load: ' temporary_file ] );
126 end
202 127 clear temporary_file
202 128 end
202 129 end
130
202 131 if strcmpi( param.train.flag, 'all' )
132 %icaoberg
133 %the file structure of the temporary files from the vesicle model
134 %is different between dimensionalities
135 if strcmpi( param.dimensionality, '2D' )
136 search_string = [ protein_model_temp_files_directory ...
137 filesep 'mixture_' num2str(index) '*.mat' ];
138 mixtures_temp_files = dir( search_string );
139
140 if ~isempty( mixtures_temp_files )
141 mixtures = {};
142
143 for index2 = 1:1:length( mixtures_temp_files )
144 mixture_file = [ protein_model_temp_files_directory filesep ...
145 mixtures_temp_files(index2).name ];
146
147 try
148 mixtures{index2} = load( mixture_file );
149 catch
150 warning( ['Unable to load: ' mixture_file ] );
151 end
152 clear mixture_file
153 end
154 end
155
156 cell_param.protein.mixtures = mixtures;
157 else
158
159 %object gaussians
160 temporary_file = [ protein_model_temp_files_directory ...
161 filesep 'object_gaussians' filesep 'gaussobjs_' ...
162 num2str(index) '.mat' ];
163
164 try
165 cell_param.protein.gaussian_objects = load( temporary_file );
166 catch
167 warning( ['Unable to load: ' temporary_file ] );
168 end
169 clear temporary_file
170
171 %object positions
172 temporary_file = [ protein_model_temp_files_directory ...
173 filesep 'object_positions' filesep num2str(index) ...
174 '_Beta.mat' ];
175
176 try
177 cell_param.protein.object_positions = load( temporary_file );
178 catch
179 warning( ['Unable to load: ' temporary_file ] );
180 end
181 clear temporary_file
182
183 %object sizes
184 temporary_file = [ protein_model_temp_files_directory ...
185 filesep 'object_sizes' filesep 'sizefits_' ...
186 num2str(index) '.mat' ];
187
188 try
189 cell_param.protein.object_sizes = load( temporary_file );
190 catch
191 warning( ['Unable to load: ' temporary_file ] );
192 end
193 clear temporary_file
194
195 %object statistics
196 temporary_file = [ protein_model_temp_files_directory ...
197 filesep 'object_stats' filesep 'gaussobjs_' ...
198 num2str(index) '.mat' ];
199
200 try
201 cell_param.protein.object_stats = load( temporary_file );
202 catch
203 warning( ['Unable to load: ' temporary_file ] );
204 end
205 clear temporary_file
206
207 %original objects
208 temporary_file = [ protein_model_temp_files_directory ...
209 filesep 'original_objects' filesep 'obj' ...
210 num2str(index) '.mat' ];
211
212 try
213 cell_param.protein.original_objects = load( temporary_file );
214 catch
215 warning( ['Unable to load: ' temporary_file ] );
216 end
217 clear temporary_file
218
219 %compartment stats
220 temporary_file = [ pwd filesep 'temp' filesep ...
221 'compartment_stats' filesep ...
222 'comparts' num2str(index) '.mat' ];
223
224 try
225 cell_param.compartments.stats = load( temporary_file );
226 catch
227 warning( ['Unable to load: ' temporary_file ] );
228 end
229 clear temporary_file
230 end
231 end
202 232 end
233
0.03 202 234 output_file = [ intermediate_results_folder filesep ...
235 'cell_' num2str(index) '.mat' ];
5.60 202 236 save( output_file, 'cell_param' )
0.01 202 237 clear cell_param
238
202 239 if param.verbose && param.debug
0.01 202 240 toc
202 241 end
202 242 end