Changeset 1134 for trunk/src/series
- Timestamp:
- Apr 19, 2024, 8:21:23 PM (6 months ago)
- Location:
- trunk/src/series
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/series/extract_rdvision.m
r1127 r1134 66 66 ParamOut.WholeIndexRange='on';...% prescribes the file index ranges from min to max (options 'off'/'on', 'off' by default) 67 67 ParamOut.NbSlice='off';%1; ...%nbre of slices, 1 prevents splitting in several processes, ('off' by default) 68 68 ParamOut.VelType='off';...% menu for selecting the velocity type (options 'off'/'one'/'two', 'off' by default) 69 69 ParamOut.FieldName='off';...% menu for selecting the field (s) in the input file(options 'off'/'one'/'two', 'off' by default) 70 70 ParamOut.FieldTransform = 'off';...%can use a transform function … … 72 72 ParamOut.Mask='off';...%can use mask option (option 'off'/'on', 'off' by default) 73 73 ParamOut.CPUTime=0.1;% expected time for writting one image ( in minute) 74 ParamOut.OutputDirExt='.extract';%set the output dir extensionextract_rdvision.m74 ParamOut.OutputDirExt='.extract';%set the output dir extension 75 75 ParamOut.OutputSubDirMode='one'; %output folder given by the folder name of the first input line 76 76 % detect the set of image folder … … 102 102 set(hhseries.InputTable,'Data',InputTable) 103 103 ParamOut.ActionInput.LogPath=RootPath;% indicate the path for the output info: 0_LOG .... 104 105 % check the names of .seq and .sqb files 106 iview=1; 107 switch Param.InputTable{iview,5} 108 case {'.seq','.sqb'} 109 filename_seq=fullfile(RootPath,Param.InputTable{iview,2},[Param.InputTable{iview,3} '.seq']); 110 filename_sqb=fullfile(RootPath,Param.InputTable{iview,2},[Param.InputTable{iview,3} '.sqb']); 111 if ~exist(filename_seq,'file') 112 msgbox_uvmat('ERROR',[filename_seq ' missing']); 113 end 114 if ~exist(filename_sqb,'file') 115 msgbox_uvmat('ERROR',[filename_sqb ' missing']); 116 end 117 filexml=[fullfile(RootPath,Param.InputTable{iview,2},Param.InputTable{iview,3}) '.xml'];%xml at the level of the image folder 118 if ~exist(filexml,'file') 119 msgbox_uvmat('ERROR',[filexml ' missing: needed to get the image organisation and timing ']); 120 return 121 end 122 [XmlData,errormsg]=imadoc2struct(filexml); 123 if ~isempty(errormsg) 124 msgbox_uvmat('ERROR',errormsg); 125 return 126 end 127 timexml=reshape(XmlData.Time(2:end,2:end)',1,[]); 128 otherwise 129 msgbox_uvmat('ERROR','bad input file : select .seq or .sqb for image extraction'); 130 return 131 end 132 % get data from .seq file 133 s=ini2struct(filename_seq); 134 SeqData=s.sequenceSettings; 135 SeqData.nb_frames=str2double(s.sequenceSettings.numberoffiles); 136 % reading the .sqb file 137 m = memmapfile(filename_sqb,'Format', { 'uint32' [1 1] 'offset'; ... 138 'uint32' [1 1] 'garbage1';... 139 'double' [1 1] 'timestamp';... 140 'uint32' [1 1] 'file_idx';... 141 'uint32' [1 1] 'garbage2' },'Repeat',SeqData.nb_frames); 142 143 timestamp=zeros(1,numel(m.Data)); 144 for ii=1: numel(m.Data) 145 timestamp(ii)=m.Data(ii).timestamp; 146 end 147 if numel(timestamp)<= numel(timexml) 148 timexml=timexml(1:numel(timestamp)); 149 else 150 msgbox_uvmat('ERROR','time sequence defined by the xml file too small') 151 return 152 end 153 difftime=timestamp-timexml; 154 if max(difftime)>0.01 155 figure 156 plot(timestamp,difftime) 157 xlabel('timestamps(s)') 158 ylabel('time difference(s)') 159 title('discrepency timestamps-timexml') 160 end 104 161 return 105 162 end 106 163 164 165 %%%%%%%%%%%% STANDARD PART %%%%%%%%%%%% 107 166 ParamOut=[]; 108 %%%%%%%%%%%% STANDARD PART %%%%%%%%%%%%109 167 %% read input parameters from an xml file if input is a file name (batch mode) 110 168 … … 128 186 % input file or frame indices i1_series,i2_series,j1_series,j2_series 129 187 [filecell,i1_series,i2_series,j1_series,j2_series]=get_file_series(Param); 130 131 %OutputDir=[Param.OutputSubDir Param.OutputDirExt];132 188 133 189 % numbers of slices and file indices … … 137 193 138 194 %determine the file type on each line from the first input file 139 140 195 FileInfo=get_file_info(filecell{1,1}); 141 196 if strcmp(FileInfo.FileType,'rdvision') 142 % if ~isequal(FileInfo.NumberOfFrames,nbfield) 143 % disp_uvmat('WARNING',['the whole series of ' num2str(FileInfo.NumberOfextract_rdvision.mFrames) ' images must be extracted at once'],checkrun) 144 % %rmfield(OutputDir) 145 % % return 146 % end 197 147 198 %% interactive input of specific parameters (for RDvision system) 148 199 display('converting images from RDvision system...') … … 166 217 %%% loop on the cameras ( #iview) 167 218 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 168 % RootPath=Param.InputTable(:,1);169 % RootFile=Param.InputTable(:,3);170 % SubDir=Param.InputTable(:,2);171 % NomType=Param.InputTable(:,4);172 % FileExt=Param.InputTable(:,5);173 174 % [XmlData,NbSlice_calib,time,errormsg]=read_multimadoc(RootPath,SubDir,RootFile,FileExt,i1_series,i2_series,j1_series,j2_series);175 % if size(time,1)>1176 % diff_time=max(max(diff(time)));177 % if diff_time>0178 % disp_uvmat('WARNING',['times of series differ by (max) ' num2str(diff_time)],checkrun)179 % end180 % end181 %182 % nbfield2=size(time,1);183 checkpreserve=0;% if =1, will npreserve the original images, else it erases them at the end184 219 185 220 for iview=1:size(Param.InputTable,1) … … 196 231 newxml=[newxml '.xml']; 197 232 198 %% get the names of .seq and .sqb files 233 %% get the names of .seq and .sqb files and save them to the log output folder .extract 199 234 switch Param.InputTable{iview,5} 200 235 case {'.seq','.sqb'} … … 202 237 filename_sqb=fullfile(RootPath,Param.InputTable{iview,2},[Param.InputTable{iview,3} '.sqb']); 203 238 errormsg=''; 204 if isequal(Param.IndexRange.first_i,1)205 239 % backup of the seq, sqb and xml files for the first frame index 240 if isequal(Param.IndexRange.first_i,1)% backup of the seq, sqb and xml files for the first frame index 206 241 logdir=[Param.OutputSubDir Param.OutputDirExt]; 207 242 [success,errormsg] = copyfile(filename_seq,[fullfile(RootPath,logdir,Param.InputTable{iview,3}) '.seq']); %copy the seq file in the upper folder … … 215 250 if check_xml 216 251 [success,errormsg] = copyfile(filexml,[fullfile(RootPath,logdir,Param.InputTable{iview,3}) '.xml']); %copy the original xml file in the upper folder 217 if ~success218 disp(errormsg)219 end252 if ~success 253 disp(errormsg) 254 end 220 255 else 221 256 disp(['error:' filexml ' missing']); … … 310 345 return 311 346 end 312 313 % check the existence of the expected output image files (from the xml) 314 315 FileDir=SeqData.sequencename; 316 FileDir=regexprep(FileDir,'_Master_Dalsa_4M180$','');%suppress '_Master_Dalsa_4M180' 317 % for i1=1:numel(timestamp)/nbfield2 318 % for j1=1:nbfield2 319 % OutputFile=fullfile_uvmat(RootPath,FileDir,'img','.png',NomTypeNew,i1,[],j1);% TODO: set NomTypeNew from SeqData.mode 320 % try 321 % A=imread(OutputFile);% check image reading (stop if error) 322 % catch ME 323 % disp(['checking ' OutputFile]) 324 % disp(ME.message) 325 % end 326 % end 327 % end 347 328 348 end 329 349 -
trunk/src/series/merge_proj.m
r1127 r1134 67 67 ParamOut.FieldName='one';% menu for selecting the field (s) in the input file(options 'off'/'one'/'two', 'off' by default) 68 68 ParamOut.FieldTransform = 'on';%can use a transform function 69 ParamOut.TransformPath=fullfile(fileparts(which('uvmat')),'transform_field');% path to transform functions (needed for compilation only) 69 %%%%% list of possible transform functions (needed only for compilation) 70 ListTransform={'phys','phys_polar','sub_field'};%list of possible transform functions (needed only for compilation) 71 if 0==1 %never satisfied but trigger compilation with the appropriate transform functions 72 for ilist=1:numel(ListTransform) 73 eval(ListTransform) 74 end 75 end 76 ParamOut.TransformPath=fullfile(fileparts(which('uvmat')),'transform_field');% path to transform functions 77 %%%%%%%% 70 78 ParamOut.ProjObject='on';%can use projection object(option 'off'/'on', 71 79 ParamOut.Mask='on';%can use mask option (option 'off'/'on', 'off' by default) … … 86 94 return 87 95 end 88 if 0==1 89 phys; % used to include phys when compiling is done 90 end 96 91 97 %%%%%%%%%%%% STANDARD PART (DO NOT EDIT) %%%%%%%%%%%% 92 98 ParamOut=[]; %default output … … 115 121 RootFile=Param.InputTable(:,3); 116 122 SubDir=Param.InputTable(:,2); 117 % NomType=Param.InputTable(:,4);118 123 FileExt=Param.InputTable(:,5); 119 124 … … 126 131 % 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 127 132 % i1_series(iview,fileindex) expresses the same indices as a 1D array in file indices 128 if ~isempty(hdisp),delete(hdisp),end ;%end the waiting display133 if ~isempty(hdisp),delete(hdisp),end %end the waiting display 129 134 130 135 NbView=numel(i1_series);%number of input file series (lines in InputTable) … … 134 139 135 140 %% determine the file type on each line from the first input file 136 NcTypeOptions={'netcdf','civx','civdata' };141 NcTypeOptions={'netcdf','civx','civdata','pivdata_fluidimage'}; 137 142 for iview=1:NbView 138 143 if ~exist(filecell{iview,1}','file') … … 178 183 %% coordinate transform or other user defined transform 179 184 transform_fct='';%default fct handle 185 checksub=0; 180 186 if isfield(Param,'FieldTransform')&&~isempty(Param.FieldTransform.TransformName) 181 187 currentdir=pwd; … … 187 193 XmlData{iview}.TransformInput=Param.TransformInput; 188 194 end 189 end 195 end 196 checksub=nargin(transform_fct);% number of input arguments for the selected transform fct 197 if checksub>2 && NbView>2 198 disp_uvmat('WARNING',['only the two first input file series will be combined by ' Param.FieldTransform.TransformName],checkrun) 199 end 190 200 end 191 201 %%%%%%%%%%%% END STANDARD PART %%%%%%%%%%%% … … 305 315 end 306 316 307 %% transform the input field (e.g; phys) if requested (no transform involving two input fields) 317 %% transform the input field iview (e.g; phys) if requested (no transform involving two input fields at this stage) 318 checksub=0; 308 319 if ~isempty(transform_fct) 309 if nargin(transform_fct)>=2 320 checksub=nargin(transform_fct); 321 if checksub==2 310 322 Data{iview}=transform_fct(Data{iview},XmlData{iview}); 311 else 323 elseif checksub==1 312 324 Data{iview}=transform_fct(Data{iview}); 313 325 end … … 338 350 %%%%%%%%%%%%%%%% END LOOP ON VIEWS %%%%%%%%%%%%%%%% 339 351 340 %% merge the NbView fields 341 [MergeData,errormsg]=merge_field(Data); 352 %% merge the NbView fields 353 if checksub<=2 354 [MergeData,errormsg]=merge_field(Data);%concatene all the input field series by fct merge_data 355 elseif checksub==3 356 MergeData=transform_fct(Data{1},XmlData{1},Data{2}); %combine the two input file series 357 else 358 MergeData=transform_fct(Data{1},XmlData{1},Data{2},XmlData{2});%combine the two input file series with calibration parameters 359 end 342 360 if ~isempty(errormsg) 343 361 disp_uvmat('ERROR',errormsg,checkrun);
Note: See TracChangeset
for help on using the changeset viewer.