- Timestamp:
- Jun 12, 2012, 12:29:19 AM (12 years ago)
- Location:
- trunk/src/series
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/series/aver_stat.m
r449 r451 97 97 ImageTypeOptions={'image','multimage','mmreader','video'}; 98 98 NcTypeOptions={'netcdf','civx','civdata'}; 99 99 100 for iview=1:nbview 100 [FileType{iview},FileInfo{iview},Object{iview}]=get_file_type(filecell{iview,1}); 101 if ~exist(filecell{iview,1}','file') 102 msgbox_uvmat('ERROR',['the first input file ' filecell{iview,1} ' does not exist']) 103 return 104 end 105 [FileType{iview},FileInfo{iview},MovieObject{iview}]=get_file_type(filecell{iview,1}); 101 106 CheckImage{iview}=~isempty(find(strcmp(FileType{iview},ImageTypeOptions)));% =1 for images 102 107 CheckNc{iview}=~isempty(find(strcmp(FileType{iview},NcTypeOptions)));% =1 for netcdf files 103 108 end 104 109 105 %% Calibration data and timing: read the ImaDoc files110 %% calibration data and timing: read the ImaDoc files 106 111 mode=''; %default 107 112 timecell={}; … … 321 326 Field=Data{1}; 322 327 end 328 329 %field projection on an object 323 330 if Param.CheckObject 324 331 [Field,errormsg]=proj_field(Field,ProjObject); … … 393 400 %%%%%%%%%%%%%%%% end loop on slices %%%%%%%%%%%%%%%% 394 401 395 %% reproduce ImaDoc/GeometryCalib for image series 396 % if isfield(XmlData{1},'GeometryCalib') && ~isempty(XmlData{1}.GeometryCalib) 397 % [tild,RootFile]=fileparts(filebase_out); 398 % outputxml=fullfile(pathdir,[RootFile '.xml']); 399 % errormsg=update_imadoc(XmlData{1}.GeometryCalib,outputxml);% introduce the calibration data in the xml file 400 % if strcmp(errormsg,'') 401 % display(['GeometryCalib transferred to ' outputxml]) 402 % else 403 % msgbox_uvmat('ERROR',errormsg); 404 % end 405 % end 406 407 %% open the result file with uvmat 408 hget_field=findobj(allchild(0),'name','get_field');%find the get_field... GUI 409 delete(hget_field) 410 uvmat(OutputFile)% open the last result file with uvmat 402 %% open the result file with uvmat (in RUN mode) 403 if checkrun 404 hget_field=findobj(allchild(0),'name','get_field');%find the get_field... GUI 405 delete(hget_field) 406 uvmat(OutputFile)% open the last result file with uvmat 407 end -
trunk/src/series/check_data_files.m
r447 r451 114 114 Tabchar=message; 115 115 else 116 datnum=zeros(1,nbfield);117 116 Tabchar={}; 118 117 %LOOP ON SLICES … … 120 119 index_slice=i_slice:NbSlice:nbfield; 121 120 filefound={}; 121 datnum=zeros(1,nbfield_j); 122 122 for ifile=1:nbfield_i 123 % index(ifile)=index_slice(ifile);124 123 stopstate=get(hseries.RUN,'BusyAction'); 125 124 if isequal(stopstate,'queue')% enable STOP command … … 129 128 detect=exist(file,'file'); % check the existence of the file 130 129 if detect==0 131 count=count+1;130 % count=count+1; 132 131 lastfield='not found'; 133 132 else … … 135 134 if isfield(datfile,'datenum') 136 135 datnum(ifile)=datfile.datenum; 137 end138 filefound(ifile)={datfile.name};136 filefound(ifile)={datfile.name}; 137 end 139 138 lastfield=''; 140 139 [FileType,FileInfo,Object]=get_file_type(file); … … 152 151 end 153 152 end 154 % if isempty(datnum)||isempty(filefound)155 153 if isempty(filefound) 156 154 if NbSlice>1 … … 161 159 else 162 160 datnum=datnum(find(datnum));%keep the non zero values corresponding to existing files 161 filefound=filefound(find(datnum)); 163 162 [first,ind]=min(datnum); 164 163 [last,indlast]=max(datnum); 165 message={['oldest modification: ' cell2mat(filefound(ind))' : ' datestr(first)];...166 ['latest modification: ' cell2mat(filefound(indlast))' : ' datestr(last)]};164 message={['oldest modification: ' filefound{ind} ' : ' datestr(first)];... 165 ['latest modification: ' filefound{indlast} ' : ' datestr(last)]}; 167 166 end 168 167 if ~isempty(Tabchar) -
trunk/src/series/sub_background.m
r447 r451 1 1 %'sub_background': substract background to an image series, used with series.fig 2 2 %------------------------------------------------------------------------ 3 % function GUI_input=sub_background(Param)4 %5 %OUTPUT6 % GUI_input=list of options in the GUI series.fig needed for the function7 %8 %INPUT:9 %num_i1: series of first indices i (given from the series interface as first_i:incr_i:last_i, mode and list_pair_civ)10 %num_i2: series of second indices i (given from the series interface as first_i:incr_i:last_i, mode and list_pair_civ)11 %num_j1: series of first indices j (given from the series interface as first_j:incr_j:last_j, mode and list_pair_civ )12 %num_j2: series of second indices j (given from the series interface as first_j:incr_j:last_j, mode and list_pair_civ)13 %Series: Matlab structure containing information set by the series interface14 % .RootPath: path to the image series15 % .RootFile: root file name16 % .FileExt: image file extension17 % .NomType: nomenclature type for file indexing18 % .NbSlice: %number of slices defined on the interface19 %----------------------------------------------------------------------20 3 % Method: 21 4 %calculate the background image by sorting the luminosity of each point … … 31 14 % nbfield2 successive images for a given slice (mode 'multilevel') 32 15 % In the mode 'volume', nbfield2=1 (1 image at each level) 16 17 % function GUI_input=sub_background(Param) 33 18 % 19 %%%%%%%%%%% GENERAL TO ALL SERIES ACTION FCTS %%%%%%%%%%%%%%%%%%%%%%%%%%% 20 %OUTPUT 21 % GUI_input=list of options in the GUI series.fig needed for the function 22 % 23 %INPUT: 24 % In run mode, the input parameters are given as a Matlab structure Param copied from the GUI series. 25 % In batch mode, Param is the name of the corresponding xml file containing the same information 26 % In the absence of input (as activated when the current Action is selected 27 % in series), the function ouput GUI_input set the activation of the needed GUI elements 28 % 29 % Param contains the elements:(use the menu bar command 'export/GUI config' in series to see the current structure Param) 30 % .InputTable: cell of input file names, (several lines for multiple input) 31 % each line decomposed as {RootPath,SubDir,Rootfile,NomType,Extension} 32 % .OutputSubDir: name of the subdirectory for data outputs 33 % .OutputDir: directory for data outputs, including path 34 % .Action: .ActionName: name of the current activated function 35 % .ActionPath: path of the current activated function 36 % .IndexRange: set the file or frame indices on which the action must be performed 37 % .FieldTransform: .TransformName: name of the selected transform function 38 % .TransformPath: path of the selected transform function 39 % .TransformHandle: corresponding function handle 40 % .InputFields: sub structure describing the input fields withfields 41 % .FieldName: name of the field 42 % .VelType: velocity type 43 % .FieldName_1: name of the second field in case of two input series 44 % .VelType_1: velocity type of the second field in case of two input series 45 % .ProjObject: %sub structure describing a projection object (read from ancillary GUI set_object) 46 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 47 48 34 49 function GUI_input=sub_background (Param) 35 50 36 %------------------------------------------------------------------------ 37 %requests for the visibility of input windows in the GUI series (activated directly by the selection in the menu ACTION) 38 if ~exist('Param','var') 39 GUI_input={'RootPath';'on';... 40 'SubDir';'off';... % subdirectory of derived files (PIV fields), ('on' by default) 41 'RootFile';'on';... %root input file name ('on' by default) 42 'FileExt';'on';... %inputf file extension ('on' by default) 43 'NomType';'on';...%type of file indexing ('on' by default) 51 %% set the input elements needed on the GUI series when the action is selected in the menu ActionName 52 if ~exist('Param','var') % case with no input parameter 53 GUI_input={'NbViewMax';1;...% max nbre of input file series (default='' , no limitation) 54 'AllowInputSort';'off';...% allow alphabetic sorting of the list of input files (options 'off'/'on', 'off' by default) 44 55 'NbSlice';'on'; ...%nbre of slices ('off' by default) 45 'OutputDirExt';'.sbk';... 46 %'VelTypeMenu';'on';...% menu for selecting the velocity type (civ1,..)('off' by default) 47 %'FieldMenu';'on';...% menu for selecting the velocity field (s) in the input file ('off' by default) 48 %'VelTypeMenu_1';'on';...% menu for selecting the velocity type (civ1,..)('off' by default) 49 %'FieldMenu_1';'on';...% menu for selecting the velocity field (s) in the input file ('off' by default) 50 %'CoordType';...%can use a transform function 51 %'GetObject';...;%can use projection object 52 %'GetMask';...;%can use mask option 53 %'PARAMETER';'NbSliding';... 54 %'PARAMETER';'VolumeScan';... 55 %'PARAMETER';'RankBrightness';... 56 'VelType';'off';...% menu for selecting the velocity type (options 'off'/'one'/'two', 'off' by default) 57 'FieldName';'off';...% menu for selecting the field (s) in the input file(options 'off'/'one'/'two', 'off' by default) 58 'FieldTransform'; 'off';...%can use a transform function 59 'ProjObject';'off';...%can use projection object(option 'off'/'on', 60 'Mask';'off';...%can use mask option (option 'off'/'on', 'off' by default) 61 'OutputDirExt';'.sbk';...%set the output dir extension 56 62 ''}; 57 return %exit the function 58 end 59 60 %% input parameters 61 % read the xml file for batch case 62 if ischar(Param) && ~isempty(find(regexp('Param','.xml$'))) 63 return 64 end 65 66 %%%%%%%%%%%% STANDARD PART (DO NOT EDIT) %%%%%%%%%%%% 67 %% get input parameters, file names and indices 68 % BATCH case: read the xml file for batch case 69 if ischar(Param) && ~isempty(find(regexp(Param,'.xml$'))) 63 70 Param=xml2struct(Param); 64 71 checkrun=0; 65 else % RUN case: parameters introduced as the input structure Param 72 % RUN case: parameters introduced as the input structure Param 73 else 66 74 hseries=guidata(Param.hseries);%handles of the GUI series 67 WaitbarPos=get(hseries.waitbar_frame,'Position'); 68 checkrun=1; 69 end 70 filebase=fullfile(Param.InputTable{1,1},Param.InputTable{1,2},Param.InputTable{1,3}); 71 dir_images=Param.InputTable{1,1}; 72 NomType=Param.InputTable{1,4}; 73 SubDir=Param.InputTable{1,2}; 74 FileExt=Param.InputTable{1,5}; 75 [filecell,i1_series,tild,j1_series]=get_file_series(Param);%generates the set of input file names 76 if size(filecell,1)>1 77 msgbox_uvmat('WARNING','This function uses only the first input image series') 75 WaitbarPos=get(hseries.waitbar_frame,'Position');%position of the waitbar on the GUI series 76 checkrun=1; % indicate the RUN option is used 77 end 78 % get the set of input file names (cell array filecell), and the lists of 79 % input file or frame indices i1_series,i2_series,j1_series,j2_series 80 [filecell,i1_series,i2_series,j1_series,j2_series]=get_file_series(Param); 81 % filecell{iview,fileindex}: cell array representing the list of file names 82 % iview: line in the table corresponding to a given file series 83 % fileindex: file index within the file series, 84 % 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 85 % i1_series(iview,fileindex) expresses the same indices as a 1D array in file indices 86 % set of frame indices used for movie or multimage input 87 if ~isempty(j1_series) 88 frame_index=j1_series; 89 else 90 frame_index=i1_series; 91 end 92 93 %% root input file(s) and type 94 RootPath=Param.InputTable(:,1); 95 RootFile=Param.InputTable(:,3); 96 SubDir=Param.InputTable(:,2); 97 NomType=Param.InputTable(:,4); 98 FileExt=Param.InputTable(:,5); 99 100 % numbers of slices and file indices 101 NbSlice=1;%default 102 if isfield(Param.IndexRange,'NbSlice') 103 NbSlice=Param.IndexRange.NbSlice; 104 end 105 nbview=size(i1_series,1);%number of input file series (lines in InputTable) 106 nbfield_j=size(i1_series,2); %nb of consecutive fields at each level(burst 107 nbfield=nbfield_j*size(i1_series,3); %total number of files or frames 108 nbfield_i=floor(nbfield/NbSlice);%total number of i indexes (adjusted to an integer number of slices) 109 nbfield=nbfield_i*nbfield_j; %total number of fields after adjustement 110 111 %determine the file type on each line from the first input file 112 ImageTypeOptions={'image','multimage','mmreader','video'}; 113 NcTypeOptions={'netcdf','civx','civdata'}; 114 115 % % for iview=1:nbview 116 % if ~exist(filecell{iview,1}','file') 117 % msgbox_uvmat('ERROR',['the first input file ' filecell{iview,1} ' does not exist']) 118 % return 119 % end 120 % [FileType{iview},FileInfo{iview},Object{iview}]=get_file_type(filecell{iview,1}); 121 % CheckImage{iview}=~isempty(find(strcmp(FileType{iview},ImageTypeOptions)));% =1 for images 122 % CheckNc{iview}=~isempty(find(strcmp(FileType{iview},NcTypeOptions)));% =1 for netcdf files 123 % end 124 125 [FileType,FileInfo,MovieObject]=get_file_type(filecell{1,1}); 126 CheckImage=~isempty(find(strcmp(FileType,ImageTypeOptions)));% =1 for images 127 128 %% calibration data and timing: read the ImaDoc files 129 %not relevant here 130 131 %% check coincidence in time for several input file series 132 %not relevant here 133 134 %% coordinate transform or other user defined transform 135 %not relevant here 136 137 %%%%%%%%%%%% END STANDARD PART %%%%%%%%%%%% 138 % EDIT FROM HERE 139 140 %% check the validity of input file types 141 if CheckImage 142 FileExtOut='.png'; % write result as .png images for image inputs 143 NomTypeOut='_1_1'; 144 else 145 msgbox_uvmat('ERROR',['invalid file type input: ' FileType{1} ' not an image']) 78 146 return 79 147 end 80 81 %% determine input image type 82 FileType=[];%default 83 MovieObject=[]; 84 %FileExt=Series.FileExt; 85 86 if isequal(lower(FileExt),'.avi') 87 hhh=which('mmreader'); 88 if ~isequal(hhh,'')&& mmreader.isPlatformSupported() 89 MovieObject=mmreader(fullfile(RootPath,SubDir,[RootFile FileExt])); 90 FileType='movie'; 91 else 92 FileType='avi'; 93 end 94 elseif isequal(lower(FileExt),'.vol') 95 FileType='vol'; 96 else 97 form=imformats(FileExt(2:end)); 98 if ~isempty(form)% if the extension corresponds to an image format recognized by Matlab 99 if isequal(NomType,'*'); 100 FileType='multimage'; 101 else 102 FileType='image'; 103 end 104 end 105 end 106 if isempty(FileType) 107 msgbox_uvmat('ERROR',['invalid file extension ' FileExt ': this function only accepts image or movie input']) 108 return 109 end 110 111 nbslice_i=Param.NbSlice; %number of slices 112 siz=size(i1_series{1}); 148 % 149 % NomTypeOut='_1-2_1';% output file index will indicate the first and last ref index in the series 150 % if NbSlice~=nbfield_j 151 % answer=msgbox_uvmat('INPUT_Y-N',['will not average slice by slice: for so cancel and set NbSlice= ' num2str(nbfield_j)]); 152 % if ~strcmp(answer,'Yes') 153 % return 154 % end 155 % end 156 157 %% Set field names and velocity types 158 %not relevant here 159 160 161 %% Initiate output fields 162 %not relevant here 163 164 %%% SPECIFIC PART BEGINS HERE 165 NbSlice=Param.IndexRange.NbSlice; %number of slices 166 siz=size(i1_series); 113 167 nbaver_init=23;%approximate number of images used for the sliding background: to be adjusted later to include an integer number of bursts 114 168 j1=[];%default … … 119 173 120 174 %% adjust the proposed number of images in the sliding average to include an integer number of bursts 121 if siz( 2)~=1122 nbaver=floor(nbaver_init/siz( 1)); % number of bursts used for the sliding background,175 if siz(3)~=1 176 nbaver=floor(nbaver_init/siz(2)); % number of bursts used for the sliding background, 123 177 if isequal(floor(nbaver/2),nbaver) 124 178 nbaver=nbaver+1;%put the number of burst to an odd number (so the middle burst is defined) 125 179 end 126 nbaver_init=nbaver*siz(1);%propose by default an integer number of bursts 127 end 128 129 %% create dir of the new images 130 if test_level 131 term='.sbk.lev'; 132 else 133 term='.sbk'; 134 end 135 SubdirResult=[Param.InputTable{1,2} term]; 136 try 137 mkdir(fullfile(Param.InputTable{1,1},SubdirResult)); 138 catch ME 139 msgbox_uvmat('ERROR',['error in creating result directory: ' ME.message]); 140 return 141 end 142 [xx,msg2] = fileattrib(fullfile(Param.InputTable{1,1},SubdirResult),'+w','g'); %yield writing access (+w) to user group (g) 143 if ~strcmp(msg2,'') 144 msgbox_uvmat('ERROR',['pb of permission for ' fullfile(Param.InputTable{1,1},SubdirResult) ': ' msg2])%error message for directory creation 145 return 180 nbaver_init=nbaver*siz(2);%propose by default an integer number of bursts 146 181 end 147 182 … … 149 184 prompt = {'Number of images for the sliding background (MUST FIT IN COMPUETER MEMORY)';'The number of positions (laser slices)';'volume scan mode (Yes/No)';... 150 185 'the luminosity rank chosen to define the background (0.1=for dense particle seeding, 0.5 (median) for sparse particles'}; 151 dlg_title = ['get (slice by slice) a sliding background and substract to each image, result in subdir ' SubdirResult];186 dlg_title = ['get (slice by slice) a sliding background and substract to each image, result in subdir ' Param.OutputDir]; 152 187 num_lines= 3; 153 def = { num2str(nbaver_init);num2str( nbslice_i);'No';'0.1'};188 def = { num2str(nbaver_init);num2str(NbSlice);'No';'0.1'}; 154 189 answer = inputdlg(prompt,dlg_title,num_lines,def); 155 190 set(hseries.ParamVal,'String',answer([1 [3:4]])) … … 157 192 158 193 nbaver_ima=str2num(answer{1});%number of images for the sliding background 159 nbaver=ceil(nbaver_ima/siz( 1));%number of bursts for the sliding background194 nbaver=ceil(nbaver_ima/siz(2));%number of bursts for the sliding background 160 195 if isequal(floor(nbaver/2),nbaver) 161 196 nbaver=nbaver+1;%put the number of burst to an odd number (so the middle burst is defined) 162 197 end 163 step=siz( 1);%case of bursts: the sliding background is shifted by one burst198 step=siz(2);%case of bursts: the sliding background is shifted by one burst 164 199 vol_test=answer{3}; 165 200 if isequal(vol_test,'Yes') 166 201 nbfield2=1;%case of volume: no consecutive series at a given level 167 nbslice_i=siz(1);%number of slices202 NbSlice=siz(2);%number of slices 168 203 else 169 nbfield2=siz( 1); %nb of consecutive images at each level(burst)170 if siz( 2)>1171 % nbslice_i=str2num(answer{2})/(num_i1(1,2)-num_i1(1,1));% number of slices172 nbslice_i=str2num(answer{2})/(i1_series{1}(1,2)-i1_series{1}(1,1));% number of slices204 nbfield2=siz(2); %nb of consecutive images at each level(burst) 205 if siz(3)>1 206 % NbSlice=str2num(answer{2})/(num_i1(1,2)-num_i1(1,1));% number of slices 207 NbSlice=str2num(answer{2})/(i1_series(1,1,2)-i1_series(1,1,1));% number of slices 173 208 else 174 nbslice_i=1;175 end 176 if ~isequal(floor( nbslice_i),nbslice_i)209 NbSlice=1; 210 end 211 if ~isequal(floor(NbSlice),NbSlice) 177 212 msgbox_uvmat('ERROR','the number of slices must be a multiple of the i increment') 178 213 return … … 183 218 rank=1;%rank selected in the sorted image series 184 219 end 185 lengthtot=siz( 1)*siz(2);186 nbfield=floor(lengthtot/(nbfield2* nbslice_i));%total number of i indexes (adjusted to an integer number of slices)220 lengthtot=siz(2)*siz(3); 221 nbfield=floor(lengthtot/(nbfield2*NbSlice));%total number of i indexes (adjusted to an integer number of slices) 187 222 nbfield_slice=nbfield*nbfield2;% number of fields per slice 188 223 if nbaver_ima > nbfield*nbfield2 … … 198 233 199 234 %% prealocate memory for the sliding background 200 % first_image=name_generator(filebase,num_i1(1),num_j1(1),FileExt,NomType); 201 % Afirst=read_image(first_image,FileType,num_i1(1),MovieObject); 202 Afirst=read_image(filecell{1,1},FileType,i1_series{1}(1),MovieObject); 235 Afirst=read_image(filecell{1,1},FileType{1},MovieObject,i1_series(1,1)); 203 236 [npy,npx]=size(Afirst); 204 237 try … … 212 245 %% update the xml file 213 246 SubDirBase=regexprep(Param.InputTable{1,2},'\..*','');%take the root part of SubDir, before the first dot '.' 214 filexml=fullfile( Param.InputTable{1,1},[SubDirBase '.xml']);247 filexml=fullfile(RootPath{1},[SubDirBase '.xml']); 215 248 if ~exist(filexml,'file') && exist([filebase '.xml'],'file')% xml inside the image directory 216 249 copyfile([filebase '.xml'],filexml);% copy the .xml file … … 227 260 j1=j1_series{1}(1); 228 261 end 229 ImageName=fullfile_uvmat([dir_images term],'',Param.InputTable{1,3},'.png',NomType,i1_series{1}(1),[],j1); 230 % ImageName=name_generator(filebase_b,num_i1(1),num_j1(1),'.png',NomType); 262 ImageName=fullfile_uvmat([dir_images term],'',RootFile{1},'.png',NomType,i1_series(1,1),[],j1); 231 263 [pth,ImageName]=fileparts(ImageName); 232 264 ImageName=[ImageName '.png']; … … 250 282 end 251 283 [t,NbSlice_uid]=add(t,new_uid,'element','NbSlice'); 252 [t]=add(t,new_uid,'chardata',num2str( nbslice_i));284 [t]=add(t,new_uid,'chardata',num2str(NbSlice)); 253 285 [t,NbSlidingImages_uid]=add(t,new_uid,'element','NbSlidingImages'); 254 286 [t]=add(t,NbSlidingImages_uid,'chardata',num2str(nbaver)); … … 263 295 264 296 %MAIN LOOP ON SLICES 265 for islice=1: nbslice_i297 for islice=1:NbSlice 266 298 %% select the series of image indices at the level islice 267 299 for ifield=1:nbfield 268 300 for iburst=1:nbfield2 269 indselect(iburst,ifield)=((ifield-1)* nbslice_i+(islice-1))*nbfield2+iburst;301 indselect(iburst,ifield)=((ifield-1)*NbSlice+(islice-1))*nbfield2+iburst; 270 302 end 271 303 end … … 275 307 ifile=indselect(ifield); 276 308 filename=filecell{1,ifile}; 277 % filename=name_generator(filebase,num_i1(ifile),num_j1(ifile),FileExt,NomType); 278 Aread=read_image(filename,FileType,i1_series{1}(ifile),MovieObject); 309 Aread=read_image(filename,FileType,MovieObject,i1_series{1}(ifile)); 279 310 Ak(:,:,ifield)=Aread; 280 311 end … … 291 322 j1=j1_series{1}(ifile); 292 323 end 293 newname=fullfile_uvmat(Param.InputTable{1,1},SubdirResult,Param.InputTable{1,3},'.png',NomType,i1_series{1}(ifile),[],j1); 324 newname=fullfile_uvmat(RootPath{1},Param.OutputSubDir,RootFile{1},FileExtOut,NomTypeOut,i1_series(1,ifile),[],i_slice,[]); 325 % newname=fullfile_uvmat(RootPath{1},SubdirResult,RootFile{1},'.png',NomType,i1_series{1}(ifile),[],j1); 294 326 %newname=name_generator(filebase_b,i1_series{1}(ifile),j1_series{1}(ifile),'.png',NomType);% makes the new file name 295 327 if test_level … … 307 339 if checkrun 308 340 stopstate=get(hseries.RUN,'BusyAction'); 309 update_waitbar(hseries.waitbar_frame,WaitbarPos,(ifield+(islice-1)*nbfield_slice)/(nbfield_slice* nbslice_i))341 update_waitbar(hseries.waitbar_frame,WaitbarPos,(ifield+(islice-1)*nbfield_slice)/(nbfield_slice*NbSlice)) 310 342 else 311 343 stopstate='queue'; … … 316 348 for iburst=1:step 317 349 ifile=indselect(ifield+step*floor(nbaver/2)+iburst-1); 318 filename=fullfile_uvmat( Param.InputTable{1,1},SubDir,Param.InputTable{1,3},FileExt,NomType,i1_series{1}(ifile),[],j1_series{1}(ifile));350 filename=fullfile_uvmat(RootPath{1},SubDir,RootFile{1},FileExt,NomType,i1_series(1,ifile),[],j1_series(1,ifile)); 319 351 %filename=name_generator(filebase,num_i1(ifile),num_j1(ifile),FileExt,NomType); 320 Aread=read_image(filename,FileType, i1_series{1}(ifile),MovieObject);352 Aread=read_image(filename,FileType,MovieObject,i1_series(1,ifile)); 321 353 Ak(:,:,nbaver_ima-step+iburst)=Aread; 322 354 end … … 332 364 j1=j1_series{1}(ifile); 333 365 end 334 newname=fullfile_uvmat(Param.InputTable{1,1},SubdirResult,Param.InputTable{1,3},'.png',NomType,i1_series{1}(ifile),[],j1); 366 newname=fullfile_uvmat(RootPath{1},Param.OutputSubDir,RootFile{1},FileExtOut,NomTypeOut,i1_series(1,1),[],i_slice,[]); 367 % newname=fullfile_uvmat(Param.InputTable{1,1},SubdirResult,Param.InputTable{1,3},'.png',NomType,i1_series{1}(ifile),[],j1); 335 368 %[newname]=name_generator(filebase_b,num_i1(ifile),num_j1(ifile),'.png',NomType) % makes the new file name 336 369 if test_level … … 359 392 j1=j1_series{1}(ifile); 360 393 end 361 newname=fullfile_uvmat(Param.InputTable{1,1},SubdirResult,Param.InputTable{1,3},'.png',NomType,i1_series{1}(ifile),[],j1); 394 newname=fullfile_uvmat(RootPath{1},Param.OutputSubDir,RootFile{1},FileExtOut,NomTypeOut,i1_series(1,ifile),[],j1); 395 % newname=fullfile_uvmat(Param.InputTable{1,1},SubdirResult,Param.InputTable{1,3},'.png',NomType,i1_series{1}(ifile),[],j1); 362 396 if test_level 363 397 C=levels(C); … … 376 410 %------------------------------------------------------------------------ 377 411 %--read images and convert them to the uint16 format used for PIV 378 function A=read_image( filename,type_ima,num,MovieObject)412 function A=read_image(FileName,FileType,VideoObject,num) 379 413 %------------------------------------------------------------------------ 380 414 %num is the view number needed for an avi movie 381 switch type_ima 382 case 'movie' 383 A=read(MovieObject,num); 384 case 'avi' 385 mov=aviread(filename,num); 386 A=frame2im(mov(1)); 415 switch FileType 416 case {'video','mmreader'} 417 A=read(VideoObject,num); 387 418 case 'multimage' 388 A=imread( filename,num);419 A=imread(FileName,num); 389 420 case 'image' 390 A=imread( filename);421 A=imread(FileName); 391 422 end 392 423 siz=size(A); 393 424 if length(siz)==3;%color images 394 A=sum(double(A),3); 425 A=sum(double(A),3);% take the sum of color components 395 426 end 396 427
Note: See TracChangeset
for help on using the changeset viewer.