- Timestamp:
- Mar 25, 2013, 6:34:00 PM (12 years ago)
- Location:
- trunk/src/series
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/series/aver_stat.m
r585 r592 48 48 49 49 %% set the input elements needed on the GUI series when the action is selected in the menu ActionName 50 if ~exist('Param','var') % case with no input parameter 51 ParamOut={'AllowInputSort';'off';...% allow alphabetic sorting of the list of input files (options 'off'/'on', 'off' by default) 52 'WholeIndexRange';'off';...% prescribes the file index ranges from min to max (options 'off'/'on', 'off' by default) 53 'NbSlice';'on'; ...%nbre of slices ('off' by default) 54 'VelType';'two';...% menu for selecting the velocity type (options 'off'/'one'/'two', 'off' by default) 55 'FieldName';'two';...% menu for selecting the field (s) in the input file(options 'off'/'one'/'two', 'off' by default) 56 'FieldTransform'; 'on';...%can use a transform function 57 'ProjObject';'on';...%can use projection object(option 'off'/'on', 58 'Mask';'off';...%can use mask option (option 'off'/'on', 'off' by default) 59 'OutputDirExt';'.stat';...%set the output dir extension 60 ''}; 61 return 50 if isstruct(Param) && isequal(Param.Action.RUN,0) 51 ParamOut.AllowInputSort='off';...% allow alphabetic sorting of the list of input file SubDir (options 'off'/'on', 'off' by default) 52 ParamOut.WholeIndexRange='off';...% prescribes the file index ranges from min to max (options 'off'/'on', 'off' by default) 53 ParamOut.NbSlice='on'; ...%nbre of slices ('off' by default) 54 ParamOut.VelType='two';...% menu for selecting the velocity type (options 'off'/'one'/'two', 'off' by default) 55 ParamOut.FieldName='two';...% menu for selecting the field (s) in the input file(options 'off'/'one'/'two', 'off' by default) 56 ParamOut.FieldTransform = 'on';...%can use a transform function 57 ParamOut.ProjObject='on';...%can use projection object(option 'off'/'on', 58 ParamOut.Mask='off';...%can use mask option (option 'off'/'on', 'off' by default) 59 ParamOut.OutputDirExt='.stat';%set the output dir extension 60 return 62 61 end 63 62 64 63 %%%%%%%%%%%% STANDARD PART %%%%%%%%%%%% 65 %% select different modes, RUN, parameter input, BATCH66 % BATCH case: read the xml file for batch case 64 %% read input parameters from an xml file if input is a file name (batch mode) 65 checkrun=1; 67 66 if ischar(Param) 68 Param=xml2struct(Param); 69 checkrun=0; 70 % RUN case: parameters introduced as the input structure Param 71 else 72 if isfield(Param,'Specific')&& strcmp(Param.Specific,'?') 73 checkrun=1;% will only search interactive input parameters (preparation of BATCH mode) 74 else 75 checkrun=2; % indicate the RUN option is used 76 end 77 hseries=guidata(Param.hseries);%handles of the GUI series 78 end 67 Param=xml2struct(Param);% read Param as input file (batch case) 68 checkrun=0; 69 end 70 71 79 72 ParamOut=Param; %default output 80 73 OutputDir=[Param.OutputSubDir Param.OutputDirExt]; … … 158 151 end 159 152 NomTypeOut='_1-2_1';% output file index will indicate the first and last ref index in the series 160 if checkrun==1 161 return % stop here for input checks 162 end 153 163 154 164 155 %% Set field names and velocity types … … 188 179 %%%%%%%%%%%%%%%% loop on field indices %%%%%%%%%%%%%%%% 189 180 for index=index_slice 190 if checkrun191 update_waitbar(hseries.Waitbar,index/(nbfield))192 stopstate=get(hseries.RUN,'BusyAction');193 else194 stopstate='queue';195 end181 if checkrun 182 stopstate=get(Param.RUNHandle,'BusyAction'); 183 update_waitbar(Param.WaitbarHandle,index/nbfield) 184 else 185 stopstate='queue'; 186 end 196 187 if isequal(stopstate,'queue')% enable STOP command 197 188 … … 240 231 241 232 %% calculate tps coefficients if needed 242 if isfield(Param .ProjObject,'ProjMode')&& strcmp(Param.ProjObject.ProjMode,'interp_tps')233 if isfield(Param,'ProjObject')&&isfield(Param.ProjObject,'ProjMode')&& strcmp(Param.ProjObject.ProjMode,'interp_tps') 243 234 Field=tps_coeff_field(Field,check_proj_tps); 244 235 end -
trunk/src/series/check_data_files.m
r573 r592 34 34 function ParamOut=check_data_files(Param) 35 35 36 %% set the input elements needed on the GUI series when the action is selected in the menu ActionName 37 if ~exist('Param','var') % case with no input parameter 38 ParamOut={'NbViewMax';'';...% max nbre of input file series (default='' , no limitation) 39 'AllowInputSort';'off';...% allow alphabetic sorting of the list of input files (options 'off'/'on', 'off' by default) 40 'NbSlice';'on'; ...%nbre of slices ('off' by default) 41 'VelType';'off';...% menu for selecting the velocity type (options 'off'/'one'/'two', 'off' by default) 42 'FieldName';'off';...% menu for selecting the field (s) in the input file(options 'off'/'one'/'two', 'off' by default) 43 'FieldTransform'; 'off';...%can use a transform function 44 'ProjObject';'off';...%can use projection object(option 'off'/'on', 45 'Mask';'off';...%can use mask option (option 'off'/'on', 'off' by default) 46 'OutputDirExt';'';...%set the output dir extension 47 ''}; 48 return 36 % %% set the input elements needed on the GUI series when the action is selected in the menu ActionName 37 % if ~exist('Param','var') % case with no input parameter 38 % ParamOut={'NbViewMax';'';...% max nbre of input file series (default='' , no limitation) 39 % 'AllowInputSort';'off';...% allow alphabetic sorting of the list of input files (options 'off'/'on', 'off' by default) 40 % 'NbSlice';'on'; ...%nbre of slices ('off' by default) 41 % 'VelType';'off';...% menu for selecting the velocity type (options 'off'/'one'/'two', 'off' by default) 42 % 'FieldName';'off';...% menu for selecting the field (s) in the input file(options 'off'/'one'/'two', 'off' by default) 43 % 'FieldTransform'; 'off';...%can use a transform function 44 % 'ProjObject';'off';...%can use projection object(option 'off'/'on', 45 % 'Mask';'off';...%can use mask option (option 'off'/'on', 'off' by default) 46 % 'OutputDirExt';'';...%set the output dir extension 47 % ''}; 48 % return 49 % end 50 %% input preparation mode (no RUN) 51 if isstruct(Param) && isequal(Param.Action.RUN,0) 52 ParamOut.AllowInputSort='off';...% allow alphabetic sorting of the list of input file SubDir (options 'off'/'on', 'off' by default) 53 ParamOut.WholeIndexRange='off';...% prescribes the file index ranges from min to max (options 'off'/'on', 'off' by default) 54 ParamOut.NbSlice='on'; ...%nbre of slices ('off' by default) 55 ParamOut.VelType='off';...% menu for selecting the velocity type (options 'off'/'one'/'two', 'off' by default) 56 ParamOut.FieldName='off';...% menu for selecting the field (s) in the input file(options 'off'/'one'/'two', 'off' by default) 57 ParamOut.FieldTransform = 'off';...%can use a transform function 58 ParamOut.ProjObject='off';...%can use projection object(option 'off'/'on', 59 ParamOut.Mask='off';...%can use mask option (option 'off'/'on', 'off' by default) 60 ParamOut.OutputDirExt='';%set the output dir extension (blank=no output dir) 61 return 49 62 end 50 51 63 %%%%%%%%%%%% STANDARD PART %%%%%%%%%%%% 52 64 %% select different modes, RUN, parameter input, BATCH … … 74 86 FileExt=Param.InputTable(:,5); 75 87 [filecell,i1_series,i2_series,j1_series,j2_series]=get_file_series(Param); 88 if isempty(i1_series) 89 return 90 end 76 91 %%%%%%%%%%%% 77 92 % The cell array filecell is the list of input file names, while -
trunk/src/series/check_peaklock.m
r590 r592 192 192 break 193 193 end 194 if ~isempty(NbSlice_calib)195 Data{iview}.ZIndex=mod(i1_series{iview}(index)-1,NbSlice_calib{iview})+1;%Zindex for phys transform196 end197 194 end 198 195 if isempty(errormsg) … … 209 206 end 210 207 end 211 nbfile=nbfile+1;212 208 213 209 % initiate the time series at the first iteration 214 if nbfile==1210 if index==1 215 211 % stop program if the first field reading is in error 216 212 if ~isempty(errormsg) … … 287 283 end 288 284 end 289 290 % record the time: 291 if isempty(time)% time not set by xml filer(s) 292 if isfield(Data{1},'Time') 293 DataOut.Time(nbfile,1)=Field.Time; 294 else 295 DataOut.Time(nbfile,1)=index;%default 296 end 297 else % time from ImaDoc prevails TODO: correct 298 DataOut.Time(nbfile,1)=time(index);% 299 end 300 301 % record the number of missing input fields 302 if ~isempty(errormsg) 303 nbmissing=nbmissing+1; 304 display(['index=' num2str(index) ':' errormsg]) 305 end 285 306 286 end 307 287 end -
trunk/src/series/ima_levels.m
r590 r592 40 40 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 41 41 42 function GUI_input=ima_levels (Param)42 function ParamOut=ima_levels (Param) 43 43 44 44 %% set the input elements needed on the GUI series when the action is selected in the menu ActionName 45 if ~exist('Param','var') % case with no input parameter46 GUI_input={'NbViewMax';1;...% max nbre of input file series (default='' , no limitation)47 'AllowInputSort';'off';...% allow alphabetic sorting of the list of input files(options 'off'/'on', 'off' by default)48 'NbSlice';'off'; ...%nbre of slices ('off' by default)49 'VelType';'off';...% menu for selecting the velocity type (options 'off'/'one'/'two','off' by default)50 'FieldName';'off';...% menu for selecting the field (s) in the input file(options 'off'/'one'/'two','off' by default)51 'FieldTransform'; 'off';...%can use a transform function52 'ProjObject';'off';...%can use projection object(option 'off'/'on',53 'Mask';'off';...%can use mask option (option 'off'/'on', 'off' by default)54 'OutputDirExt';'.lev';...%set the output dir extension55 ''};56 45 if isstruct(Param) && isequal(Param.Action.RUN,0) 46 ParamOut.NbViewMax=1;% max nbre of input file series (default='' , no limitation) 47 ParamOut.AllowInputSort='off';% allow alphabetic sorting of the list of input file SubDir (options 'off'/'on', 'off' by default) 48 ParamOut.WholeIndexRange='off';% prescribes the file index ranges from min to max (options 'off'/'on', 'off' by default) 49 ParamOut.NbSlice='off'; %nbre of slices ('off' by default) 50 ParamOut.VelType='off';% menu for selecting the velocity type (options 'off'/'one'/'two', 'off' by default) 51 ParamOut.FieldName='one';% menu for selecting the field (s) in the input file(options 'off'/'one'/'two', 'off' by default) 52 ParamOut.FieldTransform = 'off';%can use a transform function 53 ParamOut.ProjObject='off';%can use projection object(option 'off'/'on', 54 ParamOut.Mask='off';%can use mask option (option 'off'/'on', 'off' by default) 55 ParamOut.OutputDirExt='.lev';%set the output dir extension 56 return 57 57 end 58 58 59 59 %%%%%%%%%%%% STANDARD PART (DO NOT EDIT) %%%%%%%%%%%% 60 %% select different modes, RUN, parameter input, BATCH61 % BATCH case: read the xml file for batch case 60 %% read input parameters from an xml file if input is a file name (batch mode) 61 checkrun=1; 62 62 if ischar(Param) 63 if strcmp(Param,'input?') 64 checkrun=1;% will inly search input parameters (preparation of BATCH mode) 65 else 66 Param=xml2struct(Param); 67 checkrun=0; 68 end 69 % RUN case: parameters introduced as the input structure Param 70 else 71 hseries=guidata(Param.hseries);%handles of the GUI series 72 checkrun=2; % indicate the RUN option is used 73 end 63 Param=xml2struct(Param);% read Param as input file (batch case) 64 checkrun=0; 65 end 66 67 ParamOut=Param; %default output 68 if ~isfield(Param,'InputFields') 69 Param.InputFields.FieldName=''; 70 end 71 OutputSubDir=[Param.OutputSubDir Param.OutputDirExt];% subdirectory for output files 74 72 75 73 %% root input file(s) and type … … 154 152 j1=[];%default 155 153 for ifile=1:nbfield 156 if checkrun157 update_waitbar(hseries.Waitbar,ifile/nbfield)158 stopstate=get(hseries.RUN,'BusyAction');159 else160 stopstate='queue';161 end154 if checkrun 155 stopstate=get(Param.RUNHandle,'BusyAction'); 156 update_waitbar(Param.WaitbarHandle,ifile/nbfield) 157 else 158 stopstate='queue'; 159 end 162 160 if isequal(stopstate,'queue') % enable STOP command 163 161 if ~isempty(j1_series)&&~isequal(j1_series,{[]}) -
trunk/src/series/merge_proj.m
r585 r592 49 49 50 50 %% set the input elements needed on the GUI series when the action is selected in the menu ActionName 51 if ~exist('Param','var') % case with no input parameter 52 ParamOut={'AllowInputSort';'off';...% allow alphabetic sorting of the list of input files (options 'off'/'on', 'off' by default) 53 'WholeIndexRange';'off';...% prescribes the file index ranges from min to max (options 'off'/'on', 'off' by default) 54 'NbSlice';'on'; ...%nbre of slices ('off' by default) 55 'VelType';'one';...% menu for selecting the velocity type (options 'off'/'one'/'two', 'off' by default) 56 'FieldName';'one';...% menu for selecting the field (s) in the input file(options 'off'/'one'/'two', 'off' by default) 57 'FieldTransform'; 'on';...%can use a transform function 58 'ProjObject';'on';...%can use projection object(option 'off'/'on', 59 'Mask';'off';...%can use mask option (option 'off'/'on', 'off' by default) 60 'OutputDirExt';'.mproj';...%set the output dir extension 61 ''}; 62 return 51 if isstruct(Param) && isequal(Param.Action.RUN,0) 52 ParamOut.AllowInputSort='off';...% allow alphabetic sorting of the list of input file SubDir (options 'off'/'on', 'off' by default) 53 ParamOut.WholeIndexRange='on';...% prescribes the file index ranges from min to max (options 'off'/'on', 'off' by default) 54 ParamOut.NbSlice='off'; ...%nbre of slices ('off' by default) 55 ParamOut.VelType='one';...% menu for selecting the velocity type (options 'off'/'one'/'two', 'off' by default) 56 ParamOut.FieldName='one';...% menu for selecting the field (s) in the input file(options 'off'/'one'/'two', 'off' by default) 57 ParamOut.FieldTransform = 'on';...%can use a transform function 58 ParamOut.ProjObject='on';...%can use projection object(option 'off'/'on', 59 ParamOut.Mask='off';...%can use mask option (option 'off'/'on', 'off' by default) 60 ParamOut.OutputDirExt='.mproj';%set the output dir extension 61 return 63 62 end 64 63 65 64 %%%%%%%%%%%% STANDARD PART (DO NOT EDIT) %%%%%%%%%%%% 66 %% select different modes, RUN, parameter input, BATCH67 % BATCH case: read the xml file for batch case 65 %% read input parameters from an xml file if input is a file name (batch mode) 66 checkrun=1; 68 67 if ischar(Param) 69 Param=xml2struct(Param); 70 checkrun=0; 71 % RUN case: parameters introduced as the input structure Param 72 else 73 hseries=guidata(Param.hseries);%handles of the GUI series 74 if isfield(Param,'Specific')&& strcmp(Param.Specific,'?') 75 checkrun=1;% will only search interactive input parameters (preparation of BATCH mode) 76 else 77 checkrun=2; % indicate the RUN option is used 78 end 79 end 68 Param=xml2struct(Param);% read Param as input file (batch case) 69 checkrun=0; 70 end 71 80 72 ParamOut=Param; %default output 81 73 if ~isfield(Param,'InputFields') 82 74 Param.InputFields.FieldName=''; 83 75 end 76 OutputSubDir=[Param.OutputSubDir Param.OutputDirExt];% subdirectory for output files 84 77 85 78 %% root input file type … … 89 82 NomType=Param.InputTable(:,4); 90 83 FileExt=Param.InputTable(:,5); 91 OutputSubDir=[Param.OutputSubDir Param.OutputDirExt];% subdirectory for output files92 84 [filecell,i1_series,i2_series,j1_series,j2_series]=get_file_series(Param); 93 85 %%%%%%%%%%%% -
trunk/src/series/sub_background.m
r573 r592 55 55 function ParamOut=sub_background (Param) 56 56 57 %% set the input elements needed on the GUI series when the action is selected in the menu ActionName 58 if ~exist('Param','var') % case with no input parameter 59 ParamOut={'AllowInputSort';'off';...% allow alphabetic sorting of the list of input files (options 'off'/'on', 'off' by default) 60 'WholeIndexRange';'on';...% prescribes the file index ranges from min to max (options 'off'/'on', 'off' by default) 61 'NbSlice';'on'; ...%nbre of slices ('off' by default) 62 'VelType';'off';...% menu for selecting the velocity type (options 'off'/'one'/'two', 'off' by default) 63 'FieldName';'off';...% menu for selecting the field (s) in the input file(options 'off'/'one'/'two', 'off' by default) 64 'FieldTransform'; 'off';...%can use a transform function 65 'ProjObject';'off';...%can use projection object(option 'off'/'on', 66 'Mask';'off';...%can use mask option (option 'off'/'on', 'off' by default) 67 'OutputDirExt';'.sback';...%set the output dir extension 68 ''}; 57 %% input preparation mode (no RUN) 58 if isstruct(Param) && isequal(Param.Action.RUN,0) 59 ParamOut.AllowInputSort='off';...% allow alphabetic sorting of the list of input file SubDir (options 'off'/'on', 'off' by default) 60 ParamOut.WholeIndexRange='on';...% prescribes the file index ranges from min to max (options 'off'/'on', 'off' by default) 61 ParamOut.NbSlice='on'; ...%nbre of slices ('off' by default) 62 ParamOut.VelType='off';...% menu for selecting the velocity type (options 'off'/'one'/'two', 'off' by default) 63 ParamOut.FieldName='off';...% menu for selecting the field (s) in the input file(options 'off'/'one'/'two', 'off' by default) 64 ParamOut.FieldTransform = 'off';...%can use a transform function 65 ParamOut.ProjObject='off';...%can use projection object(option 'off'/'on', 66 ParamOut.Mask='off';...%can use mask option (option 'off'/'on', 'off' by default) 67 ParamOut.OutputDirExt='.sback';%set the output dir extension 68 69 %%%%%%%%%%%% STANDARD PART (DO NOT EDIT) %%%%%%%%%%%% 70 71 %% root input file(s) and type 72 % RootPath=Param.InputTable(:,1); 73 % RootFile=Param.InputTable(:,3); 74 % SubDir=Param.InputTable(:,2); 75 % NomType=Param.InputTable(:,4); 76 % FileExt=Param.InputTable(:,5); 77 [filecell,i1_series,i2_series,j1_series,j2_series]=get_file_series(Param); 78 %%%%%%%%%%%% 79 % The cell array filecell is the list of input file names, while 80 % filecell{iview,fileindex}: 81 % iview: line in the table corresponding to a given file series 82 % fileindex: file index within the file series, 83 % i1_series(iview,ref_j,ref_i)... are the corresponding arrays of indices i1,i2,j1,j2, depending on the input line iview and the two reference indices ref_i,ref_j 84 % i1_series(iview,fileindex) expresses the same indices as a 1D array in file indices 85 %%%%%%%%%%%% 86 NbSlice=1;%default 87 if isfield(Param.IndexRange,'NbSlice')&&~isempty(Param.IndexRange.NbSlice) 88 NbSlice=Param.IndexRange.NbSlice; 89 end 90 nbview=numel(i1_series);%number of input file series (lines in InputTable) 91 nbfield_j=size(i1_series{1},1); %nb of fields for the j index (bursts or volume slices) 92 nbfield_i=size(i1_series{1},2); %nb of fields for the i index 93 nbfield=nbfield_j*nbfield_i; %total number of fields 94 nbfield_i=floor(nbfield/NbSlice);%total number of indexes in a slice (adjusted to an integer number of slices) 95 nbfield=nbfield_i*NbSlice; %total number of fields after adjustement 96 97 %determine the file type on each line from the first input file 98 99 100 %% calibration data and timing: read the ImaDoc files 101 %not relevant here 102 103 %% check coincidence in time for several input file series 104 %not relevant here 105 106 %% coordinate transform or other user defined transform 107 %not relevant here 108 109 %%%%%%%%%%%% END STANDARD PART %%%%%%%%%%%% 110 % EDIT FROM HERE 111 112 %% check the validity of input file types 113 ImageTypeOptions={'image','multimage','mmreader','video'};%allowed input file types(images) 114 FileType=get_file_type(filecell{1,1}); 115 CheckImage=~isempty(find(strcmp(FileType,ImageTypeOptions), 1));% =1 for images 116 if ~CheckImage 117 msgbox_uvmat('ERROR',['invalid file type input: ' FileType{1} ' not an image']) 69 118 return 70 end 71 72 %%%%%%%%%%%% STANDARD PART (DO NOT EDIT) %%%%%%%%%%%% 73 %% select different modes, RUN, parameter input, BATCH 74 % BATCH case: read the xml file for batch case 119 end 120 121 %% Set field names and velocity types 122 %not relevant here 123 124 %% Initiate output fields 125 %not relevant here 126 127 %%% SPECIFIC PART BEGINS HERE 128 NbSlice=1; 129 if isfield(Param.IndexRange,'NbSlice') 130 NbSlice=Param.IndexRange.NbSlice; %number of slices 131 end 132 %siz=size(i1_series); 133 nbaver_init=23;%approximate number of images used for the sliding background: to be adjusted later to include an integer number of bursts 134 j1=[];%default 135 136 %% adjust the proposed number of images in the sliding average to include an integer number of bursts 137 if nbfield_i~=1 138 nbaver=floor(nbaver_init/nbfield_j); % number of bursts used for the sliding background, 139 if isequal(floor(nbaver/2),nbaver) 140 nbaver=nbaver+1;%put the number of burst to an odd number (so the middle burst is defined) 141 end 142 nbaver_init=nbaver*nbfield_j;%propose by default an integer number of bursts 143 end 144 145 %% input of specific parameters 146 %if checkrun %get specific parameters interactively 147 if isequal(Param.Action.RUN,0) 148 prompt = {'volume scan mode (Yes/No)';'Number of images for the sliding background (MUST FIT IN COMPUTER MEMORY)';... 149 'the luminosity rank chosen to define the background (0.1=for dense particle seeding, 0.5 (median) for sparse particles'}; 150 dlg_title = 'get (slice by slice) a sliding background and substract to each image'; 151 num_lines= 3; 152 def = { 'No';num2str(nbaver_init);'0.1'}; 153 answer = inputdlg(prompt,dlg_title,num_lines,def); 154 155 %check input consistency 156 if strcmp(answer{1},'No') && ~isequal(NbSlice,1) 157 check=msgbox_uvmat('INPUT_Y-N',['confirm the multi-level splitting into ' num2str(NbSlice) ' slices']); 158 if ~strcmp(check,'Yes') 159 return 160 end 161 end 162 if strcmp(answer{1},'Yes') 163 step=1; 164 else 165 step=nbfield_j;%case of bursts: the sliding background is shifted by the length of one burst 166 end 167 nbaver_ima=str2num(answer{2});%number of images for the sliding background 168 nbaver=ceil(nbaver_ima/step);%number of bursts for the sliding background 169 if isequal(floor(nbaver/2),nbaver) 170 nbaver=nbaver+1;%set the number of bursts to an odd number (so the middle burst is defined) 171 end 172 nbaver_ima=nbaver*step; 173 end 174 ParamOut.InputGUI.CheckVolume=strcmp(answer{1},'Yes'); 175 ParamOut.InputGUI.SlidingSequenceLength=nbaver_ima; 176 ParamOut.InputGUI.BrightnessRankThreshold=str2num(answer{3}); 177 178 % apply the image rescaling function 'level' (avoid the blinking effects of bright particles) 179 answer=msgbox_uvmat('INPUT_Y-N','apply image rescaling function levels.m after sub_background'); 180 ParamOut.InputGUI.CheckLevelTransform=strcmp(answer,'Yes'); 181 return 182 end 183 %%%%%%%%%%%%%%%%%%%%%% STOP HERE FOR PAMETER INPUT MODE %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 184 185 %% read input parameters from an xml file if input is a file name (batch mode) 186 checkrun=1; 75 187 if ischar(Param) 76 Param=xml2struct(Param); 77 checkrun=0; 78 % RUN case: parameters introduced as the input structure Param 79 else 80 hseries=guidata(Param.hseries);%handles of the GUI series 81 if isfield(Param,'Specific')&& strcmp(Param.Specific,'?') 82 checkrun=1;% will search input parameters (preparation of BATCH mode) 83 else 84 checkrun=2; % indicate the RUN option is used 85 end 86 end 87 ParamOut=Param; %default output 88 OutputDir=[Param.OutputSubDir Param.OutputDirExt]; 89 90 %% root input file(s) and type 188 Param=xml2struct(Param);% read Param as input file (batch case) 189 checkrun=0; 190 end 191 192 %% Input preparation 193 nbaver_ima=Param.InputGUI.SlidingSequenceLength; 194 NbSlice=Param.IndexRange.NbSlice; 195 if ~isequal(NbSlice,1) 196 display(['multi-level splitting into ' num2str(NbSlice) ' slices']); 197 end 91 198 RootPath=Param.InputTable(:,1); 92 199 RootFile=Param.InputTable(:,3); … … 95 202 FileExt=Param.InputTable(:,5); 96 203 [filecell,i1_series,i2_series,j1_series,j2_series]=get_file_series(Param); 97 %%%%%%%%%%%% 98 % The cell array filecell is the list of input file names, while 99 % filecell{iview,fileindex}: 100 % iview: line in the table corresponding to a given file series 101 % fileindex: file index within the file series, 102 % i1_series(iview,ref_j,ref_i)... are the corresponding arrays of indices i1,i2,j1,j2, depending on the input line iview and the two reference indices ref_i,ref_j 103 % i1_series(iview,fileindex) expresses the same indices as a 1D array in file indices 104 %%%%%%%%%%%% 105 NbSlice=1;%default 106 if isfield(Param.IndexRange,'NbSlice')&&~isempty(Param.IndexRange.NbSlice) 107 NbSlice=Param.IndexRange.NbSlice; 108 end 109 nbview=numel(i1_series);%number of input file series (lines in InputTable) 204 [FileType{1},FileInfo{1},MovieObject{1}]=get_file_type(filecell{1,1}); 205 if ~isempty(j1_series{1}) 206 frame_index{1}=j1_series{1}; 207 else 208 frame_index{1}=i1_series{1}; 209 end 110 210 nbfield_j=size(i1_series{1},1); %nb of fields for the j index (bursts or volume slices) 111 211 nbfield_i=size(i1_series{1},2); %nb of fields for the i index 112 212 nbfield=nbfield_j*nbfield_i; %total number of fields 113 nbfield_i=floor(nbfield/NbSlice);%total number of indexes in a slice (adjusted to an integer number of slices) 213 nbfield_i=floor(nbfield/NbSlice);%total number of indexes in a slice (adjusted to an integer number of slices) 114 214 nbfield=nbfield_i*NbSlice; %total number of fields after adjustement 115 215 116 %determine the file type on each line from the first input file 117 ImageTypeOptions={'image','multimage','mmreader','video'};%allowed input file types(images) 118 119 [FileType{1},FileInfo{1},MovieObject{1}]=get_file_type(filecell{1,1}); 120 CheckImage{1}=~isempty(find(strcmp(FileType,ImageTypeOptions)));% =1 for images 121 if ~isempty(j1_series{1}) 122 frame_index{1}=j1_series{1}; 216 %% Output 217 FileExtOut='.png'; % write result as .png images for image inputs 218 if strcmp(lower(NomType{1}(end)),'a') 219 NomTypeOut=NomType{1};%case of letter appendix 220 elseif isempty(j1_series) 221 NomTypeOut='_1'; 123 222 else 124 frame_index{1}=i1_series{1}; 125 end 126 127 %% calibration data and timing: read the ImaDoc files 128 %not relevant here 129 130 %% check coincidence in time for several input file series 131 %not relevant here 132 133 %% coordinate transform or other user defined transform 134 %not relevant here 135 136 %%%%%%%%%%%% END STANDARD PART %%%%%%%%%%%% 137 % EDIT FROM HERE 138 139 %% check the validity of input file types 140 if CheckImage{1} 141 FileExtOut='.png'; % write result as .png images for image inputs 142 if strcmp(lower(NomType{1}(end)),'a') 143 NomTypeOut=NomType{1};%case of letter appendix 144 elseif isempty(j1_series) 145 NomTypeOut='_1'; 146 else 147 NomTypeOut='_1_1';% caseof purely numerical indexing 148 end 149 else 150 msgbox_uvmat('ERROR',['invalid file type input: ' FileType{1} ' not an image']) 223 NomTypeOut='_1_1';% caseof purely numerical indexing 224 end 225 226 OutputDir=[Param.OutputSubDir Param.OutputDirExt]; 227 228 if isequal(Param.InputGUI.CheckVolume,1) 229 step=1; 230 else 231 step=nbfield_j;%case of bursts: the sliding background is shifted by the length of one burst 232 end 233 nbaver_ima=Param.InputGUI.SlidingSequenceLength;%number of images for the sliding background 234 nbaver=ceil(nbaver_ima/step);%number of bursts for the sliding background 235 if isequal(floor(nbaver/2),nbaver) 236 nbaver=nbaver+1;%set the number of bursts to an odd number (so the middle burst is defined) 237 end 238 nbaver_ima=nbaver*step; 239 if nbaver_ima > nbfield 240 display('number of images in a slice smaller than the proposed number of images for the sliding average') 151 241 return 152 242 end 153 243 154 %% Set field names and velocity types155 %not relevant here156 157 %% Initiate output fields158 %not relevant here159 160 %%% SPECIFIC PART BEGINS HERE161 NbSlice=Param.IndexRange.NbSlice; %number of slices162 %siz=size(i1_series);163 nbaver_init=23;%approximate number of images used for the sliding background: to be adjusted later to include an integer number of bursts164 j1=[];%default165 166 %% adjust the proposed number of images in the sliding average to include an integer number of bursts167 if nbfield_i~=1168 nbaver=floor(nbaver_init/nbfield_j); % number of bursts used for the sliding background,169 if isequal(floor(nbaver/2),nbaver)170 nbaver=nbaver+1;%put the number of burst to an odd number (so the middle burst is defined)171 end172 nbaver_init=nbaver*nbfield_j;%propose by default an integer number of bursts173 end174 175 %% input of specific parameters176 if checkrun %get specific parameters interactively177 prompt = {'volume scan mode (Yes/No)';'Number of images for the sliding background (MUST FIT IN COMPUTER MEMORY)';...178 'the luminosity rank chosen to define the background (0.1=for dense particle seeding, 0.5 (median) for sparse particles'};179 dlg_title = ['get (slice by slice) a sliding background and substract to each image, result in subdir ' OutputDir];180 num_lines= 3;181 def = { 'No';num2str(nbaver_init);'0.1'};182 answer = inputdlg(prompt,dlg_title,num_lines,def);183 184 %check input consistency185 if strcmp(answer{1},'No') && ~isequal(NbSlice,1)186 check=msgbox_uvmat('INPUT_Y-N',['confirm the multi-level splitting into ' num2str(NbSlice) ' slices']);187 if ~strcmp(check,'Yes')188 return189 end190 end191 if strcmp(answer{1},'Yes')192 step=1;193 else194 step=nbfield_j;%case of bursts: the sliding background is shifted by the length of one burst195 end196 nbaver_ima=str2num(answer{2});%number of images for the sliding background197 nbaver=ceil(nbaver_ima/step);%number of bursts for the sliding background198 if isequal(floor(nbaver/2),nbaver)199 nbaver=nbaver+1;%set the number of bursts to an odd number (so the middle burst is defined)200 end201 nbaver_ima=nbaver*step;202 if nbaver_ima > nbfield203 msgbox_uvmat('ERROR','number of images in a slice smaller than the proposed number of images for the sliding average')204 return205 end206 ParamOut.Specific.CheckVolume=strcmp(answer{1},'Yes');207 ParamOut.Specific.SlidingSequenceSize=nbaver_ima;208 ParamOut.Specific.BrightnessRankThreshold=str2num(answer{3});209 210 % apply the image rescaling function 'level' (avoid the blinking effects of bright particles)211 answer=msgbox_uvmat('INPUT_Y-N','apply image rescaling function levels.m after sub_background');212 ParamOut.Specific.CheckLevelTransform=strcmp(answer,'Yes');213 if checkrun==1214 return215 end216 %%%%%%%%%%%%%%%%%%%%%% STOP HERE FOR PAMETER INPUT MODE %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%217 else218 if isequal(Param.Specific.CheckVolume,1)219 step=1;220 else221 step=nbfield_j;%case of bursts: the sliding background is shifted by the length of one burst222 end223 nbaver_ima=Param.Specific.SlidingSequenceSize;%number of images for the sliding background224 nbaver=ceil(nbaver_ima/step);%number of bursts for the sliding background225 if isequal(floor(nbaver/2),nbaver)226 nbaver=nbaver+1;%set the number of bursts to an odd number (so the middle burst is defined)227 end228 nbaver_ima=nbaver*step;229 if nbaver_ima > nbfield230 msgbox_uvmat('ERROR','number of images in a slice smaller than the proposed number of images for the sliding average')231 return232 end233 end234 235 244 % calculate absolute brightness rank 236 rank=floor(Param Out.Specific.BrightnessRankThreshold*nbaver_ima);245 rank=floor(Param.InputGUI.BrightnessRankThreshold*nbaver_ima); 237 246 if rank==0 238 247 rank=1;%rank selected in the sorted image series … … 251 260 end 252 261 catch ME 253 msgbox_uvmat('ERROR', ME.message)262 msgbox_uvmat('ERROR',['sub_background/read_image/' ME.message]) 254 263 return 255 264 end … … 338 347 339 348 %write result file 340 if Param Out.Specific.CheckLevelTransform349 if Param.InputGUI.CheckLevelTransform 341 350 C=levels(Acor); 342 351 imwrite(C,newname,'BitDepth',8); % save the new image … … 358 367 for ifield = step*ceil(nbaver/2)+1:step:nbfield_i-step*floor(nbaver/2) 359 368 if checkrun 360 stopstate=get( hseries.RUN,'BusyAction');361 update_waitbar( hseries.Waitbar,(ifield+(islice-1)*nbfield_i)/(nbfield_i*NbSlice))369 stopstate=get(Param.RUNHandle,'BusyAction'); 370 update_waitbar(Param.WaitbarHandle,(ifield+(islice-1)*nbfield_i)/(nbfield_i*NbSlice)) 362 371 else 363 372 stopstate='queue'; … … 387 396 newname=fullfile_uvmat(RootPath{1},OutputDir,RootFile{1},FileExtOut,NomTypeOut,i1_series{1}(ifile),[],j1); 388 397 %write result file 389 if Param Out.Specific.CheckLevelTransform398 if Param.InputGUI.CheckLevelTransform 390 399 C=levels(Acor); 391 400 imwrite(C,newname,'BitDepth',8); % save the new image … … 422 431 423 432 %write result file 424 if Param Out.Specific.CheckLevelTransform433 if Param.InputGUI.CheckLevelTransform 425 434 C=levels(Acor); 426 435 imwrite(C,newname,'BitDepth',8); % save the new image -
trunk/src/series/time_series.m
r585 r592 49 49 50 50 %% set the input elements needed on the GUI series when the action is selected in the menu ActionName 51 if ~exist('Param','var') % case with no input parameter 52 ParamOut={'AllowInputSort';'off';...% allow alphabetic sorting of the list of input files (options 'off'/'on', 'off' by default) 53 'WholeIndexRange';'off';...% prescribes the file index ranges from min to max (options 'off'/'on', 'off' by default) 54 'NbSlice';'on'; ...%nbre of slices ('off' by default) 55 'VelType';'two';...% menu for selecting the velocity type (options 'off'/'one'/'two', 'off' by default) 56 'FieldName';'two';...% menu for selecting the field (s) in the input file(options 'off'/'one'/'two', 'off' by default) 57 'FieldTransform'; 'on';...%can use a transform function 58 'ProjObject';'on';...%can use projection object(option 'off'/'on', 59 'Mask';'off';...%can use mask option (option 'off'/'on', 'off' by default) 60 'OutputDirExt';'.tseries';...%set the output dir extension 61 ''}; 62 return 51 if isstruct(Param) && isequal(Param.Action.RUN,0) 52 ParamOut.AllowInputSort='off';...% allow alphabetic sorting of the list of input file SubDir (options 'off'/'on', 'off' by default) 53 ParamOut.WholeIndexRange='off';...% prescribes the file index ranges from min to max (options 'off'/'on', 'off' by default) 54 ParamOut.NbSlice='on'; ...%nbre of slices ('off' by default) 55 ParamOut.VelType='two';...% menu for selecting the velocity type (options 'off'/'one'/'two', 'off' by default) 56 ParamOut.FieldName='two';...% menu for selecting the field (s) in the input file(options 'off'/'one'/'two', 'off' by default) 57 ParamOut.FieldTransform = 'on';...%can use a transform function 58 ParamOut.ProjObject='on';...%can use projection object(option 'off'/'on', 59 ParamOut.Mask='off';...%can use mask option (option 'off'/'on', 'off' by default) 60 ParamOut.OutputDirExt='.tseries';%set the output dir extension 61 return 63 62 end 64 63 65 64 %%%%%%%%%%%% STANDARD PART %%%%%%%%%%%% 66 %% select different modes, RUN, parameter input, BATCH67 % BATCH case: read the xml file for batch case 65 %% read input parameters from an xml file if input is a file name (batch mode) 66 checkrun=1; 68 67 if ischar(Param) 69 Param=xml2struct(Param); 70 checkrun=0; 71 % RUN case: parameters introduced as the input structure Param 72 else 73 hseries=guidata(Param.hseries);%handles of the GUI series 74 if isfield(Param,'Specific')&& strcmp(Param.Specific,'?') 75 checkrun=1;% will only search interactive input parameters (preparation of BATCH mode) 76 else 77 checkrun=2; % indicate the RUN option is used 78 end 79 end 68 Param=xml2struct(Param);% read Param as input file (batch case) 69 checkrun=0; 70 end 71 80 72 ParamOut=Param; %default output 81 73 OutputDir=[Param.OutputSubDir Param.OutputDirExt]; … … 218 210 219 211 %%%%%%%%%%%%%%%% loop on field indices %%%%%%%%%%%%%%%% 220 for index=index_slice 212 for index=index_slice 221 213 if checkrun 222 update_waitbar(hseries.Waitbar,index/(nbfield))223 stopstate=get(hseries.RUN,'BusyAction');214 stopstate=get(Param.RUNHandle,'BusyAction'); 215 update_waitbar(Param.WaitbarHandle,index/nbfield) 224 216 else 225 217 stopstate='queue';
Note: See TracChangeset
for help on using the changeset viewer.