Changeset 1180
- Timestamp:
- Mar 27, 2025, 5:59:21 PM (4 weeks ago)
- Location:
- trunk/src
- Files:
-
- 1 added
- 18 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/find_file_series.m
r1164 r1180 63 63 j2_series=zeros(1,1,1); 64 64 checkfileindexing=1; 65 if isempty(regexp(FilePath,'^http://' )) && ~exist(FilePath,'dir')65 if isempty(regexp(FilePath,'^http://', 'once')) && ~exist(FilePath,'dir') 66 66 return % don't go further if the dir path does not exist 67 67 end … … 70 70 if isempty(NomType)||strcmp(NomType,'*') 71 71 if exist(fullfileinput,'file') 72 [ tild,RootFile]=fileparts(fileinput);% case of constant name (no indexing), get the filename without its extension72 [~,RootFile]=fileparts(fileinput);% case of constant name (no indexing), get the filename without its extension 73 73 else 74 74 RootFile=''; … … 159 159 % rr=regexp(dirpair(ifile).name,detect_string,'names'); 160 160 if ~isempty(rr{ifile}) 161 i1=str2 num(rr{ifile}.i1);162 i2=str2 num(regexprep(rr{ifile}.i2,'^-',''));161 i1=str2double(rr{ifile}.i1); 162 i2=str2double(regexprep(rr{ifile}.i2,'^-','')); 163 163 j1=stra2num(regexprep(rr{ifile}.j1,'^_','')); 164 164 j2=stra2num(regexprep(rr{ifile}.j2,'^-','')); 165 165 ref_i=i1; 166 166 if isempty(i2_input) 167 if ~is empty(i2)% invalid file name if i2 does not exist in the input file167 if ~isnan(i2)% invalid file name if i2 does not exist in the input file 168 168 break 169 169 end … … 173 173 ref_j=1; 174 174 if isempty(j1_input) 175 if ~is empty(j1)% invalid file name if j1 does not exist in the input file175 if ~isnan(j1)% invalid file name if j1 does not exist in the input file 176 176 break 177 177 end 178 178 else %j1_input is not empty 179 if is empty(j1)% the detected name does not fit with the input179 if isnan(j1)% the detected name does not fit with the input 180 180 break 181 181 else 182 182 ref_j=j1; 183 183 if isempty(j2_input) 184 if ~is empty(j2)% invalid file name if j2 does not exist in the input file184 if ~isnan(j2)% invalid file name if j2 does not exist in the input file 185 185 break 186 186 end … … 191 191 end 192 192 % update the detected index series 193 if ~isempty(ref_i)&&~isempty(ref_j) 193 if ~isnan(ref_i)&&~isnan(ref_j) 194 if ref_i*ref_j>100000 195 disp('warning: inapropriate file name indexing: too large indices for scanning') 196 ref_i_list(ifile)=i1_input; 197 if isempty(j1_input) 198 ref_j_list(ifile)=1; 199 else 200 ref_j_list(ifile)=j1_input; 201 end 202 break 203 end 194 204 ref_i_list(ifile)=ref_i; 195 205 ref_j_list(ifile)=ref_j; -
trunk/src/geometry_calib.m
r1174 r1180 1196 1196 Coord(:,1)=r1*x+r2*y; 1197 1197 Coord(:,2)=r3*x+r4*y; 1198 Coord(:,1)=Coord(:,1)+O_x; 1199 Coord(:,2)=Coord(:,2)+O_y; 1198 1200 set(handles.ListCoord,'Data',Coord) 1199 1201 set(handles.APPLY,'BackgroundColor',[1 0 1]) … … 1282 1284 {'*.xml;*.mat', ' (*.xml,*.mat)'; 1283 1285 '*.xml', '.xml files '; ... 1286 '*.xml~*', 'backup .xml files '; ... 1284 1287 '*.mat', '.mat matlab files '}, ... 1285 1288 'Pick a file',oldfile); … … 1310 1313 if isfield (s,'GeometryCalib') 1311 1314 GeometryCalib=s.GeometryCalib; 1312 %fx=1;fy=1;Cx=0;Cy=0;kc=0; %default1313 %CoordCell={};1314 %Tabchar={};%default1315 1315 val_cal=1;%default 1316 1316 if ~isempty(GeometryCalib) -
trunk/src/get_file_info.m
r1178 r1180 1 %'get_file_info': determine info about a file (image, multimage, civdata,...) . 1 %'get_file_info': determine info about a file (image, multimage, civdata,...) . 2 2 %------------------------------------------------------------------------ 3 3 % [FileInfo,VideoObject]=get_file_info(fileinput) … … 19 19 % ='cine_phantom': images from fast camera Phantom 20 20 % ='bin': binary file without specific organisation 21 % ='netcdf': netcdf file 21 % ='netcdf': netcdf file 22 22 % ='civdata': netcdf files provided by civ_series 23 23 % ='civx': netcdf files provided by the obsolete program civx (in fortran) … … 69 69 return %input file does not exist. 70 70 end 71 [ tild,tild,FileExt]=fileparts(fileinput);%get the file extension FileExt71 [~,~,FileExt]=fileparts(fileinput);%get the file extension FileExt 72 72 73 73 switch FileExt … … 128 128 FileInfo.TimeName='video'; 129 129 case '.hcc' 130 %cd 'TelopsToolbox_20230707(r20340)' 131 installToolboxIRCAM 130 installToolboxIRCAM 132 131 [~,InfoArray]=readIRCam(fileinput,'HeadersOnly',true); 133 FileInfo.FileType='telopsIR'; 134 FileInfo.Height=InfoArray(1).Height; 135 FileInfo.Width=InfoArray(1).Width; 136 FileInfo.FrameRate=InfoArray(1).AcquisitionFrameRate; 137 FileInfo.NumberOfFrames=numel(InfoArray); 138 FileInfo.TimeName='video'; 132 FileInfo.FileType='telopsIR'; 133 FileInfo.Height=InfoArray(1).Height; 134 FileInfo.Width=InfoArray(1).Width; 135 FileInfo.FrameRate=InfoArray(1).AcquisitionFrameRate; 136 FileInfo.NumberOfFrames=numel(InfoArray); 137 FileInfo.TimeName='video'; 138 Path=fileparts(fileinput);% look for the xml file to document theb file series 139 [RootPath,SubDir,DirExt]=fileparts(Path); 140 if ~isempty(DirExt) 141 disp(['ERROR: change the name of the folder containing the image files: no file extension ' DirExt]) 142 FileInfo.FileType='error'; 143 return 144 end 145 XmlFile=fullfile(RootPath,[SubDir '.xml']); 146 CheckWriteImaDoc=true; 147 if exist(XmlFile,'file') 148 [XmlData,~,errormsg]=xml2struct(XmlFile); 149 if ~isempty(errormsg) 150 disp(errormsg) 151 FileInfo.FileType='error'; 152 return 153 elseif isfield(XmlData,'FileSeries') 154 CheckWriteImaDoc=false; 155 end 156 end 157 if CheckWriteImaDoc 158 DirContent=dir(Path); 159 NbFiles=0; 160 FileSeries.Convention='telopsIR'; 161 for ilist=1:numel(DirContent) 162 FName=DirContent(ilist).name; 163 if ~isempty(regexp(FName,'.hcc$', 'once')) 164 NbFiles=NbFiles+1; 165 FileSeries.FileName{NbFiles,1}=FName; 166 end 167 end 168 FileSeries.NbFramePerFile=FileInfo.NumberOfFrames; 169 [checkupdate,xmlfile,errormsg]=update_imadoc(RootPath,SubDir,'FileSeries',FileSeries); 170 end 171 139 172 otherwise 140 173 if ~isempty(FileExt)% exclude empty extension … … 160 193 FileInfo.error=ME.message; 161 194 end 195 162 196 else 163 197 error_nc=0; … … 205 239 end 206 240 FileInfo.ListDimName=Data.ListDimName; 207 % FileInfo.NumberOfFrames=Data.DimValue;241 % FileInfo.NumberOfFrames=Data.DimValue; 208 242 end 209 243 else … … 218 252 INFO=mmfileinfo (fileinput); 219 253 if ~isempty(INFO.Video.Format) 220 221 254 VideoObject=mmreader(fileinput); 222 255 FileInfo=get(VideoObject); -
trunk/src/index2filename.m
r1178 r1180 31 31 %======================================================================= 32 32 33 function [ RootFile,FileIndexString,FrameIndex]=index2filename(FileSeries,i1,j1,NbField_j)34 RootFile='';35 FileIndexString='';33 function [FileName,FrameIndex]=index2filename(FileSeries,i1,j1,NbField_j) 34 FileName=''; 35 % FileIndexString=''; 36 36 FrameIndex=1; 37 if exist('j1','var') 38 if isempty(j1) 39 j1=1; 37 if isfield(FileSeries,'FileName') 38 if exist('j1','var')&&~isnan(NbField_j) 39 if isempty(j1) 40 j1=1; 41 end 42 i_vector=(i1-1)*NbField_j+j1;%frames labeld with two indices i and j 43 else 44 i_vector=i1;% frames labelled with a single concatenated index vector 40 45 end 41 i_vector=(i1-1)*NbField_j+j1-1;%frames labeld with two indices i and j 42 else 43 i_vector=i1;% frames labelled with a single concatenated index vector 44 end 46 if ischar(FileSeries.FileName) 47 FileSeries.FileName={FileSeries.FileName}; 48 end 49 [~,~,RootFile,i1,~,~,~,FileExt,NomType]=fileparts_uvmat(FileSeries.FileName{end}); 50 FileIndex=floor((i_vector-1)/FileSeries.NbFramePerFile)+1; 51 if FileIndex>numel(FileSeries.FileName) 52 FileIndex=FileIndex-numel(FileSeries.FileName)+i1; 53 FileName=fullfile_uvmat('','',RootFile,FileExt,NomType,FileIndex); 54 else 55 FileName=FileSeries.FileName{FileIndex}; 56 end 45 57 46 switch FileSeries.Convention47 case 'PCO'48 RootFile=FileSeries.RootName;49 FileIndex=floor(i_vector/FileSeries.NbFramePerFile);50 if FileIndex>051 RootFile=[RootFile '@'];52 FileIndexString=num2str(FileIndex,'%04d');53 end54 FrameIndex=mod(i_vector,FileSeries.NbFramePerFile)+1;58 % switch FileSeries.Convention 59 % case 'PCO' 60 % RootFile=FileSeries.RootName; 61 % FileIndex=floor(i_vector/FileSeries.NbFramePerFile); 62 % if FileIndex>0 63 % RootFile=[RootFile '@']; 64 % FileIndexString=num2str(FileIndex,'%04d'); 65 % end 66 FrameIndex=mod(i_vector-1,FileSeries.NbFramePerFile)+1; 55 67 end 56 68 57 69 70 -
trunk/src/mouse_up.m
r1127 r1180 71 71 PlotData=get(AxeData.CurrentObject,'UserData');%get data attached to the current projection object 72 72 IndexObj=PlotData.IndexObj; 73 if IndexObj<=numel(UvData.ProjObject) 73 74 ObjectData=UvData.ProjObject{IndexObj}; 74 75 check_multiple=0; … … 120 121 end 121 122 end 122 123 123 124 %show object coordinates in the GUI set_object 124 125 if strcmp(ObjectData.Type,'rectangle')||strcmp(ObjectData.Type,'ellipse') … … 127 128 set(hh_set_object.num_RangeY_2,'String',num2str(ObjectData.RangeY,4)); 128 129 end 130 129 131 130 132 %% stop drawing and plot the projected field if the object manipulation is finished … … 195 197 hother=findobj('Tag','deformpoint');%find all the deformpoints 196 198 set(hother,'Color','b');%reset all the deformpoints in 'blue' 199 end 197 200 end 198 201 -
trunk/src/read_field.m
r1170 r1180 145 145 NbCoord=~isempty(ParamIn.Coord_x)+~isempty(ParamIn.Coord_y)+~isempty(ParamIn.Coord_z); 146 146 if isfield(ParamIn,'TimeDimName')% case of reading of a single time index in a multidimensional array 147 [Field, var_detect,ichoice,errormsg]=nc2struct(FileName,'TimeDimName',ParamIn.TimeDimName,frame_index,[ParamIn.Coord_x ParamIn.Coord_y ParamIn.Coord_z ListVarName]);147 [Field,~,~,errormsg]=nc2struct(FileName,'TimeDimName',ParamIn.TimeDimName,frame_index,[ParamIn.Coord_x ParamIn.Coord_y ParamIn.Coord_z ListVarName]); 148 148 elseif isfield(ParamIn,'TimeVarName')% case of reading of a single time in a multidimensional array 149 [Field, var_detect,ichoice,errormsg]=nc2struct(FileName,'TimeVarName',ParamIn.TimeVarName,frame_index,[ParamIn.Coord_x ParamIn.Coord_y ParamIn.Coord_z ListVarName]);150 if numel(frame_index)~=1151 NbCoord=NbCoord+1;% adds time coordinate, except if a single time has been selected152 end153 else 154 [Field, var_detect,ichoice,errormsg]=nc2struct(FileName,[ParamIn.Coord_x ParamIn.Coord_y ParamIn.Coord_z ListVarName]);149 [Field,~,~,errormsg]=nc2struct(FileName,'TimeVarName',ParamIn.TimeVarName,frame_index,[ParamIn.Coord_x ParamIn.Coord_y ParamIn.Coord_z ListVarName]); 150 % if numel(frame_index)~=1 151 % NbCoord=NbCoord+1;% adds time coordinate, except if a single time has been selected 152 % end 153 else 154 [Field,~,~,errormsg]=nc2struct(FileName,[ParamIn.Coord_x ParamIn.Coord_y ParamIn.Coord_z ListVarName]); 155 155 end 156 156 if ~isempty(errormsg) … … 241 241 case 'telopsIR' 242 242 [A,Header]=readIRCam(FileName,'Frames',frame_index); 243 A=flip(A); 243 244 A=(reshape(A,Header(1).Width,Header(1).Height))'; 244 A=flip(A,1);245 245 case 'mmreader' 246 246 if isa(ParamIn,'mmreader') -
trunk/src/read_image.m
r1178 r1180 81 81 case 'telopsIR' 82 82 [A,Header]=readIRCam(FileName,'Frames',num); 83 A=flip(A); 83 84 A=(reshape(A,Header(1).Width,Header(1).Height))'; 84 A=flip(A,1);85 85 case 'rdvision' 86 86 A=read_rdvision(FileName,num); -
trunk/src/rotate_points.m
r1127 r1180 120 120 y_shift=str2num(get(handles.x_0,'String')); 121 121 z_shift=str2num(get(handles.y_0,'String')); 122 if ~is empty(x_shift)122 if ~isnan(x_shift) 123 123 varargout{1}(1)=x_shift; 124 124 end 125 if ~is empty(y_shift)125 if ~isnan(y_shift) 126 126 varargout{1}(2)=y_shift; 127 127 end 128 if ~is empty(z_shift)128 if ~isnan(z_shift) 129 129 varargout{1}(3)=z_shift; 130 130 end -
trunk/src/series.m
r1179 r1180 4005 4005 first_i=str2double(get(handles.num_first_i,'String')); 4006 4006 first_j=str2double(get(handles.num_first_j,'String')); 4007 i1=(first_i-SeriesData.FileSeries{1}.FirstFileIndex)*SeriesData.FileSeries{1}.NbFramePerFile+1;%frame index deduced from input file index 4007 %i1=(first_i-SeriesData.FileSeries{1}.FirstFileIndex)*SeriesData.FileSeries{1}.NbFramePerFile+1;%frame index deduced from input file index 4008 i1=1; 4008 4009 if strcmp(SeriesData.TimeName,'xml')% indices i and j 4009 4010 j1=mod(i1-1,nbfield_j)+first_j; -
trunk/src/series/civ_3D.m
r1165 r1180 1152 1152 end 1153 1153 if isempty(r) 1154 disp lay('wrong pair mode input option')1154 disp('wrong pair mode input option') 1155 1155 else 1156 1156 ind1=stra2num(r.num1); -
trunk/src/series/civ_input.m
r1177 r1180 1378 1378 [Path,ref.subdir,File,ref.num1,ref.num2,ref.num_a,ref.num_b,ref.ext,ref.nom_type]=fileparts_uvmat(fileinput); 1379 1379 ref.filebase=fullfile(Path,File); 1380 % ref.num_a=stra2num(str_a); 1381 % ref.num_b=stra2num(str_b); 1382 % ref.num1=str2double(field_count); 1383 % ref.num2=str2double(str2); 1384 browse=[];%initialisation 1380 1381 %browse=[];%initialisation 1385 1382 if ~isequal(ref.ext,'.nc') 1386 1383 msgbox_uvmat('ERROR','the reference file must be in netcdf format (*.nc)') -
trunk/src/series/civ_series.m
r1178 r1180 254 254 end 255 255 end 256 257 %% File relabeling documented by the xml file (e.g. PCO) 256 258 CheckRelabel=isfield(Param,'FileSeries' );%=true for index relabeling (PCO) 257 259 … … 340 342 ImageName_A=Param.ActionInput.RefFile; 341 343 elseif CheckRelabel 342 [RootFile,F ileIndexString,FrameIndex_A]=index2filename(Param.FileSeries,i1_series_Civ1(ifield),j1_series_Civ1(ifield),MaxIndex_j);343 ImageName_A=fullfile(RootPath_A,SubDir_A, [RootFile FileIndexString FileExt_A]);344 [RootFile,FrameIndex_A]=index2filename(Param.FileSeries,i1_series_Civ1(ifield),j1_series_Civ1(ifield),MaxIndex_j); 345 ImageName_A=fullfile(RootPath_A,SubDir_A,RootFile); 344 346 else 345 347 ImageName_A=fullfile_uvmat(RootPath_A,SubDir_A,RootFile_A,FileExt_A,NomType_A,i1_series_Civ1(ifield),[],j1_series_Civ1(ifield)); … … 355 357 FileType_A=FileInfo_A.FileType; 356 358 if isempty(Time) && ~isempty(find(strcmp(FileType_A,{'mmreader','video','cine_phantom','telopsIR'}), 1))% case of video input 357 Time=zeros(FileInfo_A.NumberOfFrames+1,2); 359 Time=zeros(FileInfo_A.NumberOfFrames+1,2); 358 360 Time(:,2)=(0:1/FileInfo_A.FrameRate:(FileInfo_A.NumberOfFrames)/FileInfo_A.FrameRate)'; 359 360 361 361 if ~isempty(j1_series_Civ1) && j1_series_Civ1~=1 362 Time=Time'; 363 end 362 364 end 363 365 if ~isempty(FileType_A) && isempty(Time)% Time = index i +0.001 index j by default … … 378 380 time_input=toc(tsart_input); 379 381 end 380 if CheckRelabel381 [RootFile,FileIndexString,FrameIndex_B]=index2filename(Param.FileSeries,i1_series_Civ1(ifield),j1_series_Civ1(ifield),MaxIndex_j);382 ImageName_B=fullfile(RootPath_B,SubDir_B,[RootFile FileIndexString FileExt_B]);383 else384 ImageName_B=fullfile_uvmat(RootPath_B,SubDir_B,RootFile_B,FileExt_B,NomType_B,i2_series_Civ1(ifield),[],j2_series_Civ1(ifield));385 FrameIndex_B=FrameIndex_B_Civ1(ifield);386 end382 if CheckRelabel 383 [RootFile,FrameIndex_B]=index2filename(Param.FileSeries,i2_series_Civ1(ifield),j2_series_Civ1(ifield),MaxIndex_j); 384 ImageName_B=fullfile(RootPath_B,SubDir_B,RootFile); 385 else 386 ImageName_B=fullfile_uvmat(RootPath_B,SubDir_B,RootFile_B,FileExt_B,NomType_B,i2_series_Civ1(ifield),[],j2_series_Civ1(ifield)); 387 FrameIndex_B=FrameIndex_B_Civ1(ifield); 388 end 387 389 if isempty(FileType_B)% determine the image type for the first field 388 390 [FileInfo_B,VideoObject_B]=get_file_info(ImageName_B); … … 394 396 end 395 397 [par_civ1.ImageB,VideoObject_B] = read_image(ImageName_B,FileType_B,VideoObject_B,FrameIndex_B); 396 398 397 399 catch ME % display errors in reading input images 398 400 if ~isempty(ME.message) … … 627 629 ImageName_A_Civ2=Param.ActionInput.RefFile; 628 630 elseif CheckRelabel 629 [RootFile,FileIndexString,FrameIndex_A_2]=index2filename(Param.FileSeries,i1_series_Civ2(ifield),j1_series_Civ2(ifield),MaxIndex_j);630 ImageName_A_Civ2=fullfile(RootPath_A,SubDir_A, [RootFile FileIndexString FileExt_A]);631 631 [RootFile,FrameIndex_A_2]=index2filename(Param.FileSeries,i1_series_Civ2(ifield),j1_series_Civ2(ifield),MaxIndex_j); 632 ImageName_A_Civ2=fullfile(RootPath_A,SubDir_A,RootFile); 633 else 632 634 ImageName_A_Civ2=fullfile_uvmat(RootPath_A,SubDir_A,RootFile_A,FileExt_A,NomType_A,i1_civ2,[],j1_civ2); 633 635 FrameIndex_A_2=FrameIndex_A_Civ2(ifield); … … 639 641 end 640 642 if CheckRelabel 641 [RootFile,FileIndexString,FrameIndex_B_2]=index2filename(Param.FileSeries,i2_civ2,j2_civ2,MaxIndex_j); 642 ImageName_B_Civ2=fullfile(RootPath_B,SubDir_B,[RootFile FileIndexString FileExt_B]); 643 else 644 645 646 ImageName_B_Civ2=fullfile_uvmat(RootPath_B,SubDir_B,RootFile_B,FileExt_B,NomType_B,i2_civ2,[],j2_civ2); 647 FrameIndex_B_2=FrameIndex_B_Civ2(ifield); 643 [RootFile,FrameIndex_B_2]=index2filename(Param.FileSeries,i2_civ2,j2_civ2,MaxIndex_j); 644 ImageName_B_Civ2=fullfile(RootPath_B,SubDir_B,RootFile); 645 else 646 ImageName_B_Civ2=fullfile_uvmat(RootPath_B,SubDir_B,RootFile_B,FileExt_B,NomType_B,i2_civ2,[],j2_civ2); 647 FrameIndex_B_2=FrameIndex_B_Civ2(ifield); 648 648 end 649 649 if strcmp(ImageName_B_Civ2,ImageName_B) && isequal(FrameIndex_B_2,FrameIndex_B) -
trunk/src/series/sub_background.m
r1179 r1180 78 78 ParamOut.VelType='off';% menu for selecting the velocity type (options 'off'/'one'/'two', 'off' by default) 79 79 ParamOut.FieldName='off';% menu for selecting the field (s) in the input file(options 'off'/'one'/'two', 'off' by default) 80 ParamOut.FieldTransform = 'off';%can use a transform function 81 ParamOut.ProjObject='off';%cannot use projection object(option 'off'/'on', 82 ParamOut.Mask='o n';%canuse mask option (option 'off'/'on', 'off' by default)80 ParamOut.FieldTransform = 'off';%can use a transform function (option 'off'/'on','off' by default) 81 ParamOut.ProjObject='off';%cannot use projection object(option 'off'/'on','off' by default) 82 ParamOut.Mask='off';%cannot use mask option (option 'off'/'on', 'off' by default) 83 83 ParamOut.OutputDirExt='.sback';%set the output dir extension 84 84 ParamOut.OutputFileMode='NbInput';% '=NbInput': 1 output file per input file index, '=NbInput_i': 1 file per input file index i, '=NbSlice': 1 file per slice … … 250 250 %% Input file info 251 251 if CheckRelabel 252 [RootFileOut,FileIndexString]=index2filename(Param.FileSeries,Param.IndexRange.first_i,j_indices(1),NbField_j);253 FirstFileName=fullfile(RootPath,SubDir,[RootFileOut FileIndexString FileExt]);254 else 255 FirstFileName=fullfile_uvmat(RootPath,SubDir,RootFile,FileExt,NomType,Param.IndexRange.first_i,[],j_indices(1));%get first file name256 RootFileOut=RootFile;252 [RootFileOut,frame_index]=index2filename(Param.FileSeries,Param.IndexRange.first_i,j_indices(1),NbField_j); 253 FirstFileName=fullfile(RootPath,SubDir,RootFileOut); 254 else 255 FirstFileName=fullfile_uvmat(RootPath,SubDir,RootFile,FileExt,NomType,Param.IndexRange.first_i,[],j_indices(1));%get first file name 256 RootFileOut=RootFile; 257 257 end 258 258 [FileInfo,MovieObject]=get_file_info(FirstFileName); 259 259 FileType=FileInfo.FileType; 260 if isfield(FileInfo,'NumberOfFrames') && FileInfo.NumberOfFrames >1 261 if isempty(regexp(NomType,'1$', 'once'))% no file indexing 262 frame_index=i_indices;% the index i denotes the frame number in a movie, no index j 260 if ~CheckRelabel 261 if isfield(FileInfo,'NumberOfFrames') && FileInfo.NumberOfFrames >1 262 if isempty(regexp(NomType,'1$', 'once'))% no file indexing 263 frame_index=i_indices;% the index i denotes the frame number in a movie, no index j 264 else 265 frame_index=j_indices;% the index j denotes the frame number in a movie 266 MovieObject=[]; %not a single video object 267 end 263 268 else 264 frame_index=j_indices;% the index j denotes the frame number in a movie 265 MovieObject=[]; %not a single video object 266 end 267 else 268 frame_index=ones(1,nbfield); 269 frame_index=ones(1,nbfield); 270 end 269 271 end 270 272 … … 288 290 289 291 %% prealocate memory for the sliding background 290 Ak=zeros(FileInfo.Height,FileInfo.Width,nbaver_ima,['uint' num2str(FileInfo.BitDepth)]); %prealocate memory 292 Ak=zeros(FileInfo.Height,FileInfo.Width,nbaver_ima,['uint' num2str(FileInfo.BitDepth)]); %prealocate memory 291 293 292 294 %% selection of frame indices 293 if Param.ActionInput.CheckVolume 295 if Param.ActionInput.CheckVolume 294 296 nbfield=floor(nbfield/NbSlice_j)*NbSlice_j;% truncate the total number of frames in case of incomplete series 295 297 indselect=1:nbfield; 296 297 298 else 299 298 indselect=reshape(indselect,NbSlice_j,[]); 299 NbSlice=NbSlice_j; 300 else 301 NbSlice=NbSlice_i; 300 302 nbfield=floor(nbfield/NbSlice)*NbSlice;% truncate the total number of frames in case of incomplete series 301 303 indselect=reshape(1:nbfield,NbSlice,[]); 302 304 for j_slice=1:NbSlice 303 indselect(j_slice,:)=j_slice:NbSlice:nbfield;% select file indices of the slice305 indselect(j_slice,:)=j_slice:NbSlice:nbfield;% select file indices of the slice 304 306 end 305 307 end … … 313 315 %filename=filecell{1,ifile}; 314 316 if CheckRelabel 315 [ RootFile,FileIndexString,FrameIndex]=index2filename(Param.FileSeries,i_indices(ifile),j_indices(ifile),NbField_j);316 filename=fullfile(RootPath,SubDir,[RootFile FileIndexString FileExt]);317 [filename,FrameIndex]=index2filename(Param.FileSeries,i_indices(ifile),j_indices(ifile),NbField_j); 318 filename=fullfile(RootPath,SubDir,filename); 317 319 else 318 320 filename=fullfile_uvmat(RootPath,SubDir,RootFile,FileExt,NomType,i_indices(ifile),[],j_indices(ifile)); … … 368 370 ifile=indselect(j_slice,ifield+iburst+step*halfnbaver); 369 371 if CheckRelabel 370 [ RootFile,FileIndexString,FrameIndex]=index2filename(Param.FileSeries,i_indices(ifile),j_indices(ifile),NbField_j);371 filename=fullfile(RootPath,SubDir, [RootFile FileIndexString FileExt]);372 [filename,FrameIndex]=index2filename(Param.FileSeries,i_indices(ifile),j_indices(ifile),NbField_j); 373 filename=fullfile(RootPath,SubDir,filename); 372 374 else 373 375 filename=fullfile_uvmat(RootPath,SubDir,RootFile,FileExt,NomType,i_indices(ifile),[],j_indices(ifile)); -
trunk/src/stra2num.m
r1127 r1180 30 30 31 31 function numres=stra2num(str) 32 numres=[]; %default 33 if double(str) >= 48 & double(str) <= 57 % = test for number strings 34 numres=str2double(str); 35 elseif double(str) >= 65 & double(str) <= 90 % test on ascii code for capital letters 32 numres=str2double(str); %default 33 if isnan(numres) 34 if double(str) >= 65 & double(str) <= 90 % test on ascii code for capital letters 36 35 numres=double(str)-64; %change capital letters to corresponding number in the alphabet 37 elseif double(str) >= 97 & double(str) <= 122 % test on ascii code for small letters36 elseif double(str) >= 97 & double(str) <= 122 % test on ascii code for small letters 38 37 numres=double(str)-96; %change small letters to corresponding number in the alphabet 38 end 39 39 end -
trunk/src/struct2xml.m
r1127 r1180 51 51 [t,branch_uid]=add(t,root_uid,'element',fieldnames{ilist}); 52 52 t=struct2xml(val,t,branch_uid); 53 54 % fieldnames_sub=fields(val)55 % for ilist_sub=1:length(fieldnames_sub)56 % if isstruct(fieldnames_sub{ilist_sub})57 % t=struct2xml(fieldnames_sub{ilist_sub},t,uid);58 % % save(t)59 % else60 % val_sub=val.(fieldnames_sub{ilist_sub});61 % t=add_element(t,uid,fieldnames_sub{ilist_sub},val_sub);62 % end63 % end64 53 else 65 54 t=add_element(t,root_uid,fieldnames{ilist},val); -
trunk/src/uvmat.m
r1179 r1180 517 517 end 518 518 end 519 520 521 522 % -----------------------------------------------------------------------523 % --- Executes on the menu Open/Browse campaign...524 % --- search the file inside a campaign, using the GUI browse_data525 % -----------------------------------------------------------------------526 function MenuBrowseCampaign_Callback(hObject, eventdata, handles)527 % set(handles.MenuOpenCampaign,'ForegroundColor',[1 1 0])528 % drawnow529 [RootPath,SubDir,RootFile,FileIndices,FileExt]=read_file_boxes(handles);530 DataSeries=fullfile(RootPath,SubDir);531 if isempty(DataSeries) %loads the previously stored file name and set it as default in the file_input box532 DataSeries=get(handles.RootPath,'UserData');533 end534 OutPut=browse_data(DataSeries,'on');% open the GUI browse_data to get select a campaign dir, experiment and device535 if ~isfield(OutPut,'Campaign')536 return537 end538 DataSeries=fullfile(OutPut.Campaign,OutPut.Experiment{1},OutPut.DataSeries{1});539 fileinput=uigetfile_uvmat('pick an input file',DataSeries);540 hh=dir(fileinput);541 if numel(hh)>1542 msgbox_uvmat('ERROR','invalid input, probably a broken link');543 return544 end545 546 %% update the list of campaigns in the menubar547 MenuCampaign=[{get(handles.MenuCampaign_1,'Label')};{get(handles.MenuCampaign_2,'Label')};...548 {get(handles.MenuCampaign_3,'Label')};{get(handles.MenuCampaign_4,'Label')};{get(handles.MenuCampaign_5,'Label')}];549 check_dir=isempty(find(strcmp(DataSeries,MenuCampaign)));550 if check_dir %insert the new campaign in the list if it is not found551 MenuCampaign(end)=[]; %suppress the last item552 MenuCampaign=[{DataSeries};MenuCampaign];%insert the new campaign553 for ilist=1:numel(MenuCampaign)554 set(handles.(['MenuCampaign_' num2str(ilist)]),'Label',MenuCampaign{ilist})555 end556 % save the list for future opening:557 dir_perso=prefdir;558 profil_perso=fullfile(dir_perso,'uvmat_perso.mat');559 if exist(profil_perso,'file')560 save (profil_perso,'MenuCampaign','RootPath','-append'); %store the file names for future opening of uvmat561 else562 save (profil_perso,'MenuCampaign','RootPath','-V6'); %store the file names for future opening of uvmat563 end564 end565 566 %% display the selected field and related information567 %display_file_name( handles,fullfile(DirName,FileName))568 display_file_name( handles,fileinput)569 set(handles.MenuOpenCampaign,'ForegroundColor',[0 0 0])570 571 % -----------------------------------------------------------------------572 % --- Open again as second field the file whose name has been recorded in MenuFile_1573 % -----------------------------------------------------------------------574 function MenuCampaign_Callback(hObject, eventdata, handles)575 576 set(handles.MenuOpenCampaign,'ForegroundColor',[1 1 0])577 OutPut=browse_data(get(hObject,'Label'),'on');% open the GUI browse_data to get select a campaign dir, experiment and device578 if isfield(OutPut,'Campaign')579 fileinput=uigetfile_uvmat('pick an input file',fullfile(OutPut.Campaign,OutPut.Experiment{1},OutPut.DataSeries{1}));580 hh=dir(fileinput);581 if numel(hh)>1582 msgbox_uvmat('ERROR','invalid input, probably a broken link');583 else584 display_file_name(handles,fileinput)585 end586 end587 set(handles.MenuOpenCampaign,'ForegroundColor',[0 0 0])588 589 519 590 520 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% … … 1169 1099 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 1170 1100 %------------------------------------------------------------------------ 1101 function MenuRuler_Callback(hObject, eventdata, handles) 1102 %------------------------------------------------------------------------ 1103 if strcmp(get(handles.MenuRuler,'checked'),'on') 1104 set(handles.MenuRuler,'checked','off')%desactivate if activated 1105 else 1106 set(handles.MenuRuler,'checked','on')%activate if selected 1107 set(handles.CheckZoom,'Value',0) 1108 CheckZoom_Callback(handles.uvmat, [], handles) 1109 UvData=get(handles.uvmat,'UserData'); 1110 UvData.MouseAction='ruler'; 1111 set(handles.uvmat,'UserData',UvData); 1112 end 1113 1114 %------------------------------------------------------------------------ 1171 1115 function MenuCalib_Callback(hObject, eventdata, handles) 1172 1116 %------------------------------------------------------------------------ … … 1995 1939 set_grid(FileName,UvData.Field);% call the set_object interface 1996 1940 1997 1998 %------------------------------------------------------------------------ 1999 function MenuRuler_Callback(hObject, eventdata, handles) 2000 %------------------------------------------------------------------------ 2001 if strcmp(get(handles.MenuRuler,'checked'),'on') 2002 set(handles.MenuRuler,'checked','off')%desactivate if activated 2003 else 2004 set(handles.MenuRuler,'checked','on')%activate if selected 2005 set(handles.CheckZoom,'Value',0) 2006 CheckZoom_Callback(handles.uvmat, [], handles) 2007 UvData=get(handles.uvmat,'UserData'); 2008 UvData.MouseAction='ruler'; 2009 set(handles.uvmat,'UserData',UvData); 1941 %------------------------------------------------------------------------ 1942 %-- introduce a section FileSeries in the xml file ImaDoc to virtually relabel frames 1943 % -------------------------------------------------------------------- 1944 function MenuRelabelFrames_Callback(hObject, eventdata, handles) 1945 1946 [RootPath,SubDir,RootFile,FileIndex,FileExt]=read_file_boxes(handles); 1947 FileName=[fullfile(RootPath,SubDir,RootFile) FileIndex FileExt]; 1948 CheckAbort=false; 1949 if strcmp(get(handles.MenuRelabelFrames,'checked'),'off')% if the option is selected 1950 if strcmp(FileExt,'.tif') && ~isempty(regexp(RootFile,'^im', 'once'))% case of PCO images, document <FileSeries> in the xml file 1951 FileName=[fullfile(RootPath,SubDir,RootFile) FileIndex FileExt]; 1952 FileInfo=get_file_info(FileName); 1953 XmlFile=fullfile(RootPath,[SubDir '.xml']); 1954 [XmlData,errormsg]=imadoc2struct(XmlFile); 1955 if ~isempty(errormsg) 1956 disp(['a file ' XmlFile ' is needed to document the timing']) 1957 CheckAbort=true; 1958 elseif ~isfield(XmlData,'FileSeries')% fill the FleSeries if does not exist 1959 FileSeries.Convention='PCO'; 1960 FileSeries.FileName{1,1}='im.tif'; 1961 FileSeries.FileName{2,1}='im@0001.tif'; 1962 FileSeries.NbFramePerFile=FileInfo.NumberOfFrames; 1963 [checkupdate,xmlfile,errormsg]=update_imadoc(RootPath,SubDir,'FileSeries',FileSeries); 1964 if isempty(errormsg) 1965 disp([xmlfile 'updated with FileSeries']) 1966 else 1967 disp(errormsg) 1968 CheckAbort=true; 1969 end 1970 end 1971 end 1972 if ~CheckAbort 1973 set(handles.MenuRelabelFrames,'checked','on') 1974 end 1975 else 1976 set(handles.MenuRelabelFrames,'checked','off')%if the option was chcked, uncheck it 1977 end 1978 if ~CheckAbort 1979 errormsg=display_file_name(handles,FileName,1); 1980 if ~isempty(errormsg) 1981 disp(errormsg) 1982 end 2010 1983 end 2011 1984 … … 2015 1988 2016 1989 %------------------------------------------------------------------------ 2017 % open the GUI 'series' 1990 % open the GUI 'series' with the current file series as input 2018 1991 function MenuRun1_Callback(hObject, eventdata, handles) 2019 1992 %------------------------------------------------------------------------ 2020 1993 MenuRun(hObject,handles); 2021 1994 2022 1995 %------------------------------------------------------------------------ 1996 % open the GUI 'series' with the current file series as input 2023 1997 % -------------------------------------------------------------------- 2024 1998 function MenuRun2_Callback(hObject, eventdata, handles) 2025 1999 MenuRun(hObject,handles); 2026 % Param=read_GUI(handles.uvmat); 2027 % Param.HiddenData=get(handles.uvmat,'UserData'); 2028 % hseries=series(Param); 2029 % hhseries=guidata(hseries); 2030 % ActionMenu=get(hhseries.ActionName,'String'); 2031 % index_action=find(strcmp('civ_series',ActionMenu)); 2032 % set(hhseries.ActionName,'Value',index_action); 2033 % series('ActionName_Callback',hObject,eventdata,hhseries); %file input with xml reading in uvmat, show the image in phys coordinates 2034 2000 2001 %------------------------------------------------------------------------ 2002 % open the GUI 'series' with the current file series as input 2035 2003 % -------------------------------------------------------------------- 2036 2004 function MenuRun3_Callback(hObject, eventdata, handles) 2037 2005 MenuRun(hObject,handles); 2038 % Param=read_GUI(handles.uvmat); 2039 % Param.HiddenData=get(handles.uvmat,'UserData'); 2040 % hseries=series(Param); 2041 % hhseries=guidata(hseries); 2042 % ActionMenu=get(hhseries.ActionName,'String'); 2043 % index_action=find(strcmp('test_filter_tps',ActionMenu)); 2044 % set(hhseries.ActionName,'Value',index_action); 2045 % series('ActionName_Callback',hObject,eventdata,hhseries); %file input with xml reading in uvmat, show the image in phys coordinates 2046 2006 2007 %------------------------------------------------------------------------ 2008 % open the GUI 'series' with the current file series as input 2009 % -------------------------------------------------------------------- 2047 2010 function MenuRun(hObject,handles) 2048 2011 Param=read_GUI(handles.uvmat); … … 2311 2274 elseif isfield(FileInfo,'VolumeScan') 2312 2275 Mask.VolumeScan=FileInfo.VolumeScan; 2313 end2314 set(handles.CheckMask,'UserData', Mask)2276 end 2277 set(handles.CheckMask,'UserData', Mask) 2315 2278 else 2316 2279 set(handles.CheckMask,'Value',0) 2317 2280 CheckMask_Callback(handles.CheckMask, [], handles) 2318 end2281 end 2319 2282 else %read the current field index to synchronise with the first series 2320 2283 i1_s=str2double(get(handles.i1,'String')); … … 2419 2382 set(handles.FixVelType,'Value',0); %desactivate fixed veltype by default 2420 2383 2421 %% look for the xml file and read it2422 XmlFileName=find_imadoc(RootPath,SubDir); 2384 %% look for the ImaDoc xml file and read it 2385 XmlFileName=find_imadoc(RootPath,SubDir);% search the appropriate ImaDoc xml file 2423 2386 [~,XmlName]=fileparts(XmlFileName); 2424 2387 warntext='';%default warning message 2425 2388 NbSlice=1;%default 2426 %CheckImaDoc=false;2427 2389 TimeUnit='';%default 2428 2390 TimeName='';%default 2429 CheckIndexing=false;%default2430 2391 XmlData=[]; 2431 if isempty(XmlFileName) 2392 if isempty(XmlFileName) %no ImaDoc xml file detected 2432 2393 set(handles.view_xml,'Visible','off') 2433 2394 else … … 2441 2402 end 2442 2403 if ~isempty(XmlData) 2443 %CheckImaDoc=true;2444 2404 if isfield(XmlData,'TimeUnit')&& ~isempty(XmlData.TimeUnit) 2445 2405 TimeUnit=XmlData.TimeUnit; 2446 2406 end 2447 2407 if isfield(XmlData,'Time')&& ~isempty(XmlData.Time) 2448 TimeName='xml';% 2449 if XmlData.Time(1,:)==XmlData.Time(2,:)% case starting with index 1 2450 sizDti=size(XmlData.Time,1)-1;%size of the time vector explicitly defined in the xml file 2451 ind_start=1; 2452 else 2453 sizDti=size(XmlData.Time,1);% case starting with index 0 2454 ind_start=0; 2455 end 2456 if isfield(XmlData,'FileSeries') 2457 if strcmp(XmlName,SubDir)% frame indexing documented from the xml file (case PCO) 2458 CheckIndexing=true; 2459 else 2460 XmlData=rmfield(XmlData,'FileSeries');%desactivate file indexing option for derived file series 2461 end 2408 TimeName='xml';%Time possibly documented by the xml file (but priority to the opened file if available) 2409 % if XmlData.Time(1,:)==XmlData.Time(2,:)% case starting with index 1 2410 % sizDti=size(XmlData.Time,1)-1;%size of the time vector explicitly defined in the xml file 2411 % ind_start=1; 2412 % else 2413 % sizDti=size(XmlData.Time,1);% case starting with index 0 2414 % ind_start=0; 2415 % end 2416 if isfield(XmlData,'FileSeries')&& ~strcmp(XmlName,SubDir) 2417 XmlData=rmfield(XmlData,'FileSeries');%desactivate file indexing option for derived file series (e.g. images.png) 2462 2418 end 2463 2419 end … … 2470 2426 end 2471 2427 end 2428 XmlData.FileInfo=FileInfo; 2472 2429 2473 2430 %% get the file series 2474 2431 MovieObject=[]; 2475 if strcmp(TimeName,'xml') && strcmp(XmlName,SubDir)% get the image series info from the xml file 2476 [nbfield,nbfield_j]=size(XmlData.Time); 2477 nbfield=nbfield-1; %remove the possible index 0 2478 nbfield_j=nbfield_j-1; %remove the possible index 0 2432 if strcmp(get(handles.MenuRelabelFrames,'checked'),'on') && isfield(XmlData,'FileSeries') && isfield(XmlData.FileSeries,'FileName') 2433 CheckIndexing=true; 2434 NomType='*'; 2435 i1_series=[]; 2436 i2_series=[]; 2437 j1_series=[]; 2438 j2_series=[]; 2439 nbfield=[]; 2440 nbfield_j=[]; 2441 2442 % if iscell(XmlData.FileSeries.FileName) 2443 % [RootPath,SubDir,RootFile,i1,i2,j1,j2,Ext,NomType]=fileparts_uvmat(XmlData.FileSeries.FileName{1}); 2444 % else 2445 % [RootPath,SubDir,RootFile,i1,i2,j1,j2,Ext,NomType]=fileparts_uvmat(XmlData.FileSeries.FileName); 2446 % end 2447 if strcmp(TimeName,'xml') %&& CheckIndexing% get the image series info from the xml file 2448 [nbfield,nbfield_j]=size(XmlData.Time); 2449 nbfield=nbfield-1; %remove the possible index 0 2450 nbfield_j=nbfield_j-1; %remove the possible index 0 2479 2451 i1_series=zeros(nbfield,nbfield_j,1); 2480 i1_series(:,:,1)=(1:nbfield)'*ones(1,nbfield_j); 2481 i2_series=i1_series; 2482 if nbfield_j==1 2483 j1_series=[]; 2484 else 2485 j1_series(:,:,1)=ones(nbfield,1)*(1:nbfield_j); 2486 end 2487 j2_series=j1_series; 2488 else % scan the input folder to get the list of existing files 2489 [RootPath,SubDir,RootFile,i1_series,i2_series,j1_series,j2_series,NomType,FileInfo,MovieObject,i1,i2,j1,j2]=... 2452 i1_series(:,:,1)=(1:nbfield)'*ones(1,nbfield_j); 2453 i2_series=i1_series; 2454 if nbfield_j==1 2455 j1_series=[]; 2456 else 2457 j1_series(:,:,1)=ones(nbfield,1)*(1:nbfield_j); 2458 end 2459 j2_series=j1_series; 2460 end 2461 set(handles.i1,'String','1') 2462 set(handles.j1,'String','1') 2463 else % scan the input folder to get the list of existing files and NomType 2464 CheckIndexing=false; 2465 [~,~,~,i1_series,i2_series,j1_series,j2_series,NomType,FileInfo,MovieObject]=... 2490 2466 find_file_series(fullfile(RootPath,SubDir),FileName); 2491 2467 nbfield=max(max(max(i2_series)));% total number of fields (i index) … … 2497 2473 nbfield_j=max(max(max(j1_series))); 2498 2474 end 2499 if input_line==1 2475 if ~isempty(j1_series)&& ~strcmp(NomType,'*')% the j index is used to label the frame in multimage series 2476 set(handles.j1,'String','1') 2477 end 2478 end 2479 if input_line==1 2500 2480 set(handles.NomType,'String',NomType) 2501 2502 2503 2504 end 2505 if CheckIndexing 2506 i1=str2double(get(handles.FileIndex,'String')); 2507 if isnan(i1) 2508 i1=1; 2509 else 2510 i1=(i1-XmlData.FileSeries.FirstFileIndex)*XmlData.FileSeries.NbFramePerFile+1;%frame index deduced from input file index 2511 end 2512 if strcmp(TimeName,'xml')% indices i and j 2513 j1=mod(i1-1,nbfield_j)+1;2514 i1=floor((i1-1)/nbfield_j)+1; 2515 set(handles.j1,'String',num2str(j1)) 2516 end 2517 set(handles.i1,'String',num2str(i1)) 2518 end2481 else 2482 set(handles.NomType_1,'String',NomType) 2483 end 2484 % if CheckIndexing 2485 % % i1=str2double(get(handles.FileIndex,'String')); 2486 % % if isnan(i1) 2487 % % i1=1; 2488 % % else 2489 % % i1=(i1-XmlData.FileSeries.FirstFileIndex)*XmlData.FileSeries.NbFramePerFile+1;%frame index deduced from input file index 2490 % % end 2491 % % if strcmp(TimeName,'xml')% indices i and j 2492 % % j1=mod(i1-1,nbfield_j)+1; 2493 % % i1=floor((i1-1)/nbfield_j)+1; 2494 % % set(handles.j1,'String',num2str(j1)) 2495 % % end 2496 % % set(handles.i1,'String',num2str(i1)) 2497 % 2498 % end 2519 2499 2520 2500 … … 2534 2514 %% read timing and total frame number from the current file (e.g. movie files) 2535 2515 ColorType='falsecolor'; %default 2536 if isfield(FileInfo,'FrameRate')% frame rate given in the file (case of video data)2516 if ~CheckIndexing && isfield(FileInfo,'FrameRate')% frame rate given in the file (case of video data) 2537 2517 TimeUnit='s'; 2538 2518 if isempty(j1_series) %frame index along i … … 2562 2542 %% read parameters (time, geometric calibration..) from a documentation file (.xml advised) 2563 2543 %XmlData.GeometryCalib=[];%default 2564 if input_line==12565 [RootPath,SubDir,RootFile,FileIndices,FileExt]=read_file_boxes(handles);2566 else2567 [RootPath,SubDir,RootFile,FileIndices,FileExt]=read_file_boxes_1(handles);2568 end2544 % if input_line==1 2545 % [RootPath,SubDir,RootFile,FileIndices,FileExt]=read_file_boxes(handles); 2546 % else 2547 % [RootPath,SubDir,RootFile,FileIndices,FileExt]=read_file_boxes_1(handles); 2548 % end 2569 2549 2570 2550 %% Define timing … … 2629 2609 set(handles.TransformName,'Value',3); % phys transform by default if fixedLimits is off 2630 2610 end 2631 if isfield(XmlData .Slice,'SliceCoord')2611 if isfield(XmlData,'Slice') && isfield(XmlData.Slice,'SliceCoord') 2632 2612 siz=size(XmlData.Slice.SliceCoord); 2633 2613 if siz(1)>1 … … 3262 3242 set(handles.CheckFixPair,'Value',0) 3263 3243 end 3264 CheckFixPair=get(handles.CheckFixPair,'Value')||(isempty(i2)&& isempty(j2));3244 %CheckFixPair=get(handles.CheckFixPair,'Value')||(isempty(i2)&& isempty(j2)); 3265 3245 3266 3246 % the pair i1-i2 or j1-j2 is imposed (check box CheckFixPair selected) … … 3441 3421 if strcmp(NomType,'level') 3442 3422 indices=num2str(i1); 3443 elseif isfield(UvData,'XmlData') && isfield(UvData.XmlData{1},'FileSeries')3423 elseif strcmp(get(handles.MenuRelabelFrames,'Checked'),'on') && isfield(UvData,'XmlData') && isfield(UvData.XmlData{1},'FileSeries') 3444 3424 NbField_j_cell=get(handles.MaxIndex_j,'String'); 3445 3425 NbField_j=str2double(NbField_j_cell{1}); 3446 [RootFile,indices,FrameIndex]=index2filename(UvData.XmlData{1}.FileSeries,i1,j1,NbField_j); 3426 [RootFile,FrameIndex]=index2filename(UvData.XmlData{1}.FileSeries,i1,j1,NbField_j); 3427 [~,RootFile]=fileparts(RootFile);%suppress the file extension 3447 3428 set(handles.RootFile,'String',RootFile) 3429 indices=''; 3448 3430 else 3449 3431 indices=fullfile_uvmat('','','','',NomType,i1,i2,j1,j2); … … 3651 3633 return 3652 3634 end 3653 [F NameMulti,FileIndexString,frame_index]=index2filename(UvData.XmlData{1}.FileSeries,num_i1,num_j1,NbField_j);3654 FileName=fullfile(RootName, [FNameMulti FileIndexString Ext]);3635 [FileName,frame_index]=index2filename(UvData.XmlData{1}.FileSeries,num_i1,num_j1,NbField_j); 3636 FileName=fullfile(RootName,FileName); 3655 3637 end 3656 3638 switch UvData.FileInfo{1}.FieldType … … 3871 3853 set(handles.VelType_1,'String',[{''};menu]) 3872 3854 else 3873 3855 set(handles.VelType_1,'Visible','off') 3874 3856 end 3875 3857 % update the second field menu: the same quantity … … 3894 3876 end 3895 3877 3896 %% display time value of the current fi le3878 %% display time value of the current field 3897 3879 abstime=[];%default inputs 3898 3880 dt=[]; … … 3903 3885 TimeName=get(handles.TimeName,'String'); 3904 3886 3905 % time from xml file or video movie 3906 if strcmp(TimeName,'xml')||strcmp(TimeName,'video') 3907 if isempty(num_i2)||isnan(num_i2) 3908 num_i2=num_i1; 3909 end 3910 if isempty(num_j1)||isnan(num_j1) 3911 num_j1=1; 3912 end 3913 if isempty(num_j2)||isnan(num_j2) 3914 num_j2=num_j1; 3915 end 3916 siz=size(UvData.XmlData{1}.Time); 3917 if ~isempty(num_i1)&& ~isempty(num_i2) && num_i1>=0 &&siz(1)>=max(num_i1+1,num_i2+1) && siz(2)>=max(num_j1+1,num_j2+1) 3918 abstime=(UvData.XmlData{1}.Time(num_i1+1,num_j1+1)+UvData.XmlData{1}.Time(num_i2+1,num_j2+1))/2;%overset the time read from files 3919 dt=(UvData.XmlData{1}.Time(num_i2+1,num_j2+1)-UvData.XmlData{1}.Time(num_i1+1,num_j1+1)); 3920 Field{1}.Dt=dt; 3921 if isfield(UvData.XmlData{1},'TimeUnit') 3922 TimeUnit=UvData.XmlData{1}.TimeUnit; 3923 end 3924 end 3925 end 3926 3927 % time in the input file, not defined in a xml file or movie 3928 if isempty(abstime) 3929 if (strcmp(TimeName,'civdata')||strcmp(TimeName,'civx')||strcmp(TimeName,'timestamp'))&&isfield(Field{1},'Time') 3930 abstime=Field{1}.Time; 3931 elseif ~isempty(regexp(TimeName,'^att:', 'once')) 3932 abstime=Field{1}.(TimeName(5:end));%the time is an attribute selected by get_file 3933 if isfield(Field{1},[TimeName(5:end) 'Unit']) 3934 TimeUnit=Field{1}.([TimeName(5:end) 'Unit']); 3887 switch TimeName 3888 case 'xml' % time from ImaDoc xml file 3889 if isempty(num_i2)||isnan(num_i2) 3890 num_i2=num_i1; 3891 end 3892 if isempty(num_j1)||isnan(num_j1) 3893 num_j1=1; 3894 end 3895 if isempty(num_j2)||isnan(num_j2) 3896 num_j2=num_j1; 3897 end 3898 siz=size(UvData.XmlData{1}.Time); 3899 if ~isempty(num_i1)&& ~isempty(num_i2) && num_i1>=0 &&siz(1)>=max(num_i1+1,num_i2+1) && siz(2)>=max(num_j1+1,num_j2+1) 3900 abstime=(UvData.XmlData{1}.Time(num_i1+1,num_j1+1)+UvData.XmlData{1}.Time(num_i2+1,num_j2+1))/2;%overset the time read from files 3901 dt=(UvData.XmlData{1}.Time(num_i2+1,num_j2+1)-UvData.XmlData{1}.Time(num_i1+1,num_j1+1)); 3902 Field{1}.Dt=dt; 3903 if isfield(UvData.XmlData{1},'TimeUnit') 3904 TimeUnit=UvData.XmlData{1}.TimeUnit; 3905 end 3906 end 3907 3908 case 'video'% time obtained from the frame rate in video file 3909 if isempty(num_i2)% single video record with frame index num_i1 3910 abstime=num_i1/UvData.XmlData{1}.FileInfo.FrameRate; 3935 3911 else 3936 TimeUnit=''; 3937 end 3938 elseif ~isempty(regexp(TimeName,'^var:', 'once')) 3939 abstime=Field{1}.(TimeName(5:end));%the time is a variale selected by get_file 3940 % TODO: look for time unit attribute 3941 elseif ~isempty(regexp(TimeName,'^dim:')) 3942 abstime=str2double(get(handles.i1,'String')); 3943 TimeUnit='index'; 3944 end 3945 if isfield(Field{1},'Dt') 3946 dt=Field{1}.Dt;%dt read from the netcdf input file 3947 elseif numel(Field)==2 && isfield(Field{2},'Dt')%dt obtained from the second field if not defined in the first 3948 dt=Field{2}.Dt;%dt read from the netcdf input file 3949 end 3912 abstime=num_i2/UvData.XmlData{1}.FileInfo.FrameRate;% set of video records with frame index num_i2 3913 end 3914 TimeUnit='s'; 3915 3916 otherwise % time sought in the input file 3917 if (strcmp(TimeName,'civdata')||strcmp(TimeName,'civx')||strcmp(TimeName,'timestamp'))&&isfield(Field{1},'Time') 3918 abstime=Field{1}.Time; 3919 elseif ~isempty(regexp(TimeName,'^att:', 'once')) 3920 abstime=Field{1}.(TimeName(5:end));%the time is an attribute selected by get_file 3921 if isfield(Field{1},[TimeName(5:end) 'Unit']) 3922 TimeUnit=Field{1}.([TimeName(5:end) 'Unit']); 3923 else 3924 TimeUnit=''; 3925 end 3926 elseif ~isempty(regexp(TimeName,'^var:', 'once')) 3927 abstime=Field{1}.(TimeName(5:end));%the time is a variale selected by get_file 3928 % TODO: look for time unit attribute 3929 elseif ~isempty(regexp(TimeName,'^dim:', 'once')) 3930 abstime=str2double(get(handles.i1,'String')); 3931 TimeUnit='index'; 3932 end 3933 if isfield(Field{1},'Dt') 3934 dt=Field{1}.Dt;%dt read from the netcdf input file 3935 elseif numel(Field)==2 && isfield(Field{2},'Dt')%dt obtained from the second field if not defined in the first 3936 dt=Field{2}.Dt;%dt read from the netcdf input file 3937 end 3950 3938 end 3951 3939 set(handles.TimeValue,'String',num2str(abstime)) … … 6249 6237 6250 6238 6239 6240
Note: See TracChangeset
for help on using the changeset viewer.