Changeset 667 for trunk/src/uvmat.m
- Timestamp:
- Jul 15, 2013, 2:50:08 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/uvmat.m
r660 r667 985 985 end 986 986 end 987 if ( isfield(XmlData,'Time')&& ~isempty(XmlData.Time))987 if (strcmp(FileType,'civdata')||strcmp(FileType,'civx')) && ((isfield(XmlData,'Time')&& ~isempty(XmlData.Time))) 988 988 if index==1 989 989 set(handles.TimeName,'String','xml') … … 1182 1182 %------------------------------------------------------------------------ 1183 1183 % --- switch file index scanning options scan_i and scan_j in an exclusive way 1184 %------------------------------------------------------------------------ 1184 1185 function scan_i_Callback(hObject, eventdata, handles) 1185 %------------------------------------------------------------------------ 1186 1186 1187 if get(handles.scan_i,'Value')==1 1187 % set(handles.scan_i,'BackgroundColor',[1 1 0])1188 1188 set(handles.scan_j,'Value',0) 1189 1189 else 1190 % set(handles.scan_i,'BackgroundColor',[0.831 0.816 0.784])1191 1190 set(handles.scan_j,'Value',1) 1192 1191 end … … 1195 1194 %------------------------------------------------------------------------ 1196 1195 % --- switch file index scanning options scan_i and scan_j in an exclusive way 1196 %------------------------------------------------------------------------ 1197 1197 function scan_j_Callback(hObject, eventdata, handles) 1198 %------------------------------------------------------------------------ 1198 1199 1199 if get(handles.scan_j,'Value')==1 1200 % set(handles.scan_j,'BackgroundColor',[1 1 0])1201 1200 set(handles.scan_i,'Value',0) 1202 % set(handles.scan_i,'BackgroundColor',[0.831 0.816 0.784])1203 % NomType=get(handles.NomType,'String');1204 % switch NomType1205 % case {'_1_1-2','#_ab','%3dab'},% pair with j index1206 % set(handles.CheckFixPair,'Visible','on')% option fixed pair on/off made visible (choice of avaible pair with buttons + and - if ='off')1207 % otherwise1208 % set(handles.CheckFixPair,'Visible','off')1209 % end1210 1201 else 1211 % set(handles.scan_j,'BackgroundColor',[0.831 0.816 0.784])1212 1202 set(handles.scan_i,'Value',1) 1213 % set(handles.scan_i,'BackgroundColor',[1 1 0])1214 1203 set(handles.CheckFixPair,'Visible','off') 1215 1204 end … … 1345 1334 ListCells=struct2cell(ListStruct);% transform dir struct to a cell arrray 1346 1335 check_dir=cell2mat(ListCells(4,:));% =1 for directories, =0 for files 1347 ListFiles=ListCells(1,:);%list of file names1348 ListFiles=ListFiles(~check_dir); 1336 ListFiles=ListCells(1,:);%list of file and dri names 1337 ListFiles=ListFiles(~check_dir);%list of file names (excluding dir) 1349 1338 if ~isempty(ListFiles) 1350 1339 [tild,tild,MaskExt]=fileparts(ListFiles{1}); 1351 [tild,tild,MaskFile,i1_series,i2_series,j1_series,j2_series,MaskNomType,MaskFileType]=find_file_series(MaskPath,ListFiles{1} );1340 [tild,tild,MaskFile,i1_series,i2_series,j1_series,j2_series,MaskNomType,MaskFileType]=find_file_series(MaskPath,ListFiles{1},0); 1352 1341 if strcmp(MaskFileType,'image') && isempty(i2_series) && isempty(j2_series) 1353 1342 mdetect=1; … … 1356 1345 end 1357 1346 if mdetect==0 1358 MaskFullName=uigetfile_uvmat('pick a mask image file:', fullfile(RootPath,SubDir),'image');1347 MaskFullName=uigetfile_uvmat('pick a mask image file:',RootPath,'image'); 1359 1348 if isempty(MaskFullName) 1360 1349 set(handles.CheckMask,'Value',0) 1361 1350 end 1362 1351 [MaskPath,MaskName,MaskExt]=fileparts(MaskFullName); 1363 [tild,tild,MaskFile,i1_series,i2_series,j1_series,j2_series,MaskNomType]=find_file_series(MaskPath,[MaskName MaskExt] );1352 [tild,tild,MaskFile,i1_series,i2_series,j1_series,j2_series,MaskNomType]=find_file_series(MaskPath,[MaskName MaskExt],0); 1364 1353 if ~(isempty(i2_series) && isempty(j2_series)) 1365 1354 MaskNomType='*'; … … 2149 2138 set(handles.num_Npy,'String',num2str(ParamOut.Npy)); 2150 2139 end 2151 %2152 % if isfield(ParamOut,'TimeIndex')% case of time obtained from get_field2153 % set(handles.i1,'String',num2str(ParamOut.TimeIndex))2154 % end2155 % if isfield(ParamOut,'TimeValue')2156 % Field{1}.Time=ParamOut.TimeValue;% case of time obtained from get_field2157 % end2158 2140 Field{1}.ZIndex=z_index; %used for multiplane 3D calibration 2159 2160 2141 2161 2142 %% choose and read a second field FileName_1 if defined … … 2275 2256 set(handles.VelType,'Visible','off') 2276 2257 end 2277 % display the FieldName menu from the input file and pick the selected one:2278 % if isstruct(ParamOut)2279 % field_index=strcmp(ParamOut.FieldName,ParamOut.FieldList);2280 % set(handles.FieldName,'String',ParamOut.FieldList); %update the field menu2281 % set(handles.FieldName,'Value',find(field_index,1))2282 % end2283 2258 2284 2259 %% update the display menu for the second velocity type (second menuline) … … 2302 2277 % update the second field menu: the same quantity 2303 2278 if isstruct(ParamOut_1) 2304 % set(handles.FieldName_1,'String',[{''};ParamOut_1.FieldList]); %update the field menu2305 2279 % display the FieldName menu from the input file and pick the selected one: 2306 2280 FieldList=get(handles.FieldName_1,'String'); … … 2316 2290 set(handles.FixVelType,'Visible','off') 2317 2291 end 2318 2319 % field_index=strcmp(ParamOut_1.FieldName,ParamOut_1.FieldList);2320 % set(handles.FieldName,'String',ParamOut.FieldList); %update the field menu2321 % set(handles.FieldName,'Value',find(field_index,1))2322 2292 2323 2293 %% introduce w as background image by default for a new series (only for nbdim=2) … … 2387 2357 end 2388 2358 end 2389 % if isfield(Field{1},'Time') 2390 % abstime=Field{1}.Time;%time read from the netcdf input file 2391 % end 2392 % if numel(Field)==2 && isfield(Field{2},'Time') 2393 % abstime_1=Field{2}.Time;%time read from the netcdf input file 2394 % end 2395 2396 % look for timing in the input file if not defined in a xml file or movie 2359 2360 %% look for timing in the input file if not defined in a xml file or movie 2397 2361 if isempty(abstime) 2398 2362 TimeName=get(handles.TimeName,'String'); … … 2411 2375 end 2412 2376 end 2413 end 2414 % if ~isequal(numel(abstime),1) 2415 % abstime=[]; 2416 % end 2417 % if ~isequal(numel(abstime_1),1) 2418 % abstime_1=[]; 2419 % end 2377 end 2420 2378 set(handles.TimeValue,'String',num2str(abstime)) 2421 2379 abstime_1=[]; … … 2434 2392 end 2435 2393 end 2436 2437 2394 2438 2395 %% store the current open names, fieldname and vel types in uvmat interface … … 2480 2437 UvData.Field=tps_coeff_field(UvData.Field,check_proj_tps); 2481 2438 2482 %% analyse input field 2483 % [CellInfo,NbDimArray,errormsg]=find_field_cells(UvData.Field);% analyse the input field structure 2484 % if ~isempty(errormsg) 2485 % errormsg=['uvmat /refresh_field / find_field_cells / ' errormsg];% display error 2486 % return 2487 % end 2488 % 2489 % NbDim=max(NbDimArray);% spatial dimension of the input field 2490 % imax=find(NbDimArray==NbDim);% indices of field cells to consider 2491 % if isfield(UvData.Field,'NbDim') 2492 % NbDim=double(UvData.Field.NbDim);% deal with plane fields containing z coordinates 2493 % end 2494 % 2495 % %% get bounds and mesh (needed to propose default options for projection objects) 2496 % if NbDim>1 2497 % CoordMax=zeros(numel(imax),NbDim); 2498 % CoordMin=zeros(numel(imax),NbDim); 2499 % Mesh=zeros(1,numel(imax)); 2500 % for ind=1:numel(imax) 2501 % if strcmp(CellInfo{imax(ind)}.CoordType,'tps') 2502 % CoordName=UvData.Field.ListVarName{CellInfo{imax(ind)}.CoordIndex};% X,Y coordinates in a single variable 2503 % CoordMax(ind,NbDim)=max(max(UvData.Field.(CoordName)(1:end-3,1,:),[],1),[],3);% max of x component (2D case) 2504 % CoordMax(ind,NbDim-1)=max(max(UvData.Field.(CoordName)(1:end-3,2,:),[],1),[],3);% max of y component (2D case) 2505 % CoordMin(ind,NbDim)=min(min(UvData.Field.(CoordName)(1:end-3,1,:),[],1),[],3); 2506 % CoordMin(ind,NbDim-1)=min(min(UvData.Field.(CoordName)(1:end-3,2,:),[],1),[],3);% min of y component (2D case) 2507 % else 2508 % XName=UvData.Field.ListVarName{CellInfo{imax(ind)}.CoordIndex(end)}; 2509 % YName=UvData.Field.ListVarName{CellInfo{imax(ind)}.CoordIndex(end-1)}; 2510 % CoordMax(ind,NbDim)=max(max(UvData.Field.(XName))); 2511 % CoordMin(ind,NbDim)=min(min(UvData.Field.(XName))); 2512 % CoordMax(ind,NbDim-1)=max(max(UvData.Field.(YName))); 2513 % CoordMin(ind,NbDim-1)=min(min(UvData.Field.(YName))); 2514 % % test_x=1;%test for unstructured coordinates 2515 % if NbDim==3 2516 % ZName=UvData.Field.ListVarName{CellInfo{imax(ind)}.CoordIndex(1)}; 2517 % CoordMax(imax(ind),1)=max(max(UvData.Field.(ZName))); 2518 % CoordMin(ind,1)=min(min(UvData.Field.(ZName))); 2519 % end 2520 % end 2521 % switch CellInfo{imax(ind)}.CoordType 2522 % 2523 % case {'scattered','tps'} %unstructured coordinates 2524 % NbPoints=CellInfo{imax(ind)}.CoordSize;% total nbre of points 2525 % Mesh(ind)=(prod(CoordMax(ind,:)-CoordMin(ind,:))/NbPoints)^(1/NbDim); %(volume or area per point)^(1/NbDim) 2526 % case 'grid'%structured coordinate 2527 % NbPoints=CellInfo{imax(ind)}.CoordSize;% nbre of points in each direction 2528 % Mesh(ind)=min((CoordMax(ind,:)-CoordMin(ind,:))./(NbPoints-1)); 2529 % end 2530 % end 2531 % UvData.Field.CoordMesh=min(Mesh); 2532 % UvData.Field.XMax=max(CoordMax(:,end)); 2533 % UvData.Field.XMin=min(CoordMin(:,end)); 2534 % UvData.Field.YMax=max(CoordMax(:,end-1)); 2535 % UvData.Field.YMin=min(CoordMin(:,end-1)); 2536 % if NbDim==3 2537 % UvData.Field.ZMax=max(CoordMax(ind,1)); 2538 % UvData.Field.ZMin=max(CoordMin(ind,1)); 2539 % end 2540 % % adjust the mesh to a value 1, 2 , 5 *10^n 2541 % ord=10^(floor(log10(UvData.Field.CoordMesh)));%order of magnitude 2542 % if UvData.Field.CoordMesh/ord>=5 2543 % UvData.Field.CoordMesh=5*ord; 2544 % elseif UvData.Field.CoordMesh/ord>=2 2545 % UvData.Field.CoordMesh=2*ord; 2546 % else 2547 % UvData.Field.CoordMesh=ord; 2548 % end 2549 if ~isfield(UvData.Field,'NbDim') 2550 UvData.Field.NbDim=1; 2551 end 2439 %% get bounds and dimensions of the input field 2440 UvData.Field=find_field_bounds(UvData.Field); 2441 2552 2442 if UvData.Field.NbDim>1 2553 UvData.Field=find_field_bounds(UvData.Field);2554 2443 % default projection plane 2555 2444 if isempty(UvData.ProjObject{1}) … … 4836 4725 %------------------------------------------------------------------------ 4837 4726 %get the object file 4838 [FileName, PathName, filterindex] = uigetfile( ... 4839 {'*.xml;*.mat', ' (*.xml,*.mat)'; 4840 '*.xml', '.xml files '; ... 4841 '*.mat', '.mat matlab files '}, ... 4842 'Pick an xml Object file',get(handles.RootPath,'String')); 4843 fileinput=[PathName FileName];%complete file name 4844 sizf=size(fileinput); 4845 if (~ischar(fileinput)||~isequal(sizf(1),1)),return;end 4846 4847 %read the file 4848 [data,heading]=xml2struct(fileinput); 4849 if ~strcmp(heading,'ProjObject') 4850 msgbox_uvmat('WARNING','The xml file does not have the heading ProjObject for projection objects') 4851 end 4852 [tild,data.Name]=fileparts(FileName);% object name set as file name 4853 ListObject=get(handles.ListObject,'String'); 4854 if ~strcmp(ListObject{end},'') 4855 ListObject=[ListObject;{''}]; %append a blank to the list (if not already done) to indicate the creation of a new object 4856 set(handles.ListObject,'String',ListObject) 4857 end 4858 IndexObj=length(ListObject); 4859 4860 UvData=get(handles.uvmat,'UserData'); 4861 UvData.ProjObject{IndexObj}=[]; %create a new empty object 4862 UvData.ProjObject{IndexObj}.DisplayHandle.uvmat=[]; %no plot handle before plot_field operation 4863 UvData.ProjObject{IndexObj}.DisplayHandle.view_field=[]; %no plot handle before plot_field operation 4864 set(handles.uvmat,'UserData',UvData) 4865 set(handles.ListObject,'Value',IndexObj) 4866 hset_object=set_object(data);% call the set_object interface 4867 set(get(hset_object,'children'),'enable','on')% enable edit action on elements on GUI set_object 4868 set(handles.CheckEditObject,'Value',0); %suppress the object edit mode 4869 CheckEditObject_Callback([],[],handles) 4870 % set(handles.CheckEditObject,'BackgroundColor',[0.7,0.7,0.7]) 4871 set(handles.DeleteObject,'Visible','on') 4872 4727 fileinput=uigetfile_uvmat('pick an xml object file:',get(handles.RootPath,'String'),'.xml'); 4728 4729 if ~isempty(fileinput) 4730 %read the file 4731 [data,heading]=xml2struct(fileinput); 4732 if ~strcmp(heading,'ProjObject') 4733 msgbox_uvmat('WARNING','The xml file does not have the heading ProjObject for projection objects') 4734 end 4735 % [tild,data.Name]=fileparts(fileinput);% object name set as file name 4736 ListObject=get(handles.ListObject,'String'); 4737 4738 % if ~strcmp(ListObject{end},'') 4739 % ListObject=[ListObject;{''}]; %append a blank to the list (if not already done) to indicate the creation of a new object 4740 % set(handles.ListObject,'String',ListObject) 4741 % end 4742 ListObject=[ListObject;{data.Name}]; 4743 IndexObj=length(ListObject); 4744 UvData=get(handles.uvmat,'UserData'); 4745 UvData.ProjObject{IndexObj}=[]; %create a new empty object 4746 UvData.ProjObject{IndexObj}.DisplayHandle.uvmat=[]; %no plot handle before plot_field operation 4747 UvData.ProjObject{IndexObj}.DisplayHandle.view_field=[]; %no plot handle before plot_field operation 4748 set(handles.uvmat,'UserData',UvData) 4749 % set(handles.ListObject,'String',ListObject) 4750 % set(handles.ListObject,'Value',IndexObj) 4751 set(handles.CheckViewObject,'Value',1) 4752 set(handles.CheckViewField,'Value',1) 4753 hset_object=set_object(data);% call the set_object interface 4754 hhset_object=guidata(hset_object); 4755 set_object('PLOT_Callback',hObject,eventdata,hhset_object);% plot projection 4756 %set(get(hset_object,'children'),'enable','on')% enable edit action on elements on GUI set_object 4757 set(handles.CheckEditObject,'Value',0); %suppress the object edit mode 4758 CheckEditObject_Callback([],[],handles) 4759 set(handles.DeleteObject,'Visible','on') 4760 end 4873 4761 4874 4762 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Note: See TracChangeset
for help on using the changeset viewer.