- Timestamp:
- Jul 11, 2013, 11:56:47 PM (11 years ago)
- Location:
- trunk/src
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/fill_GUI.m
r607 r664 7 7 % INPUT: 8 8 % Param: matlab structure containing the information to display in the GUI 9 % handles: Matlab structure containing the handles of the GUI elements9 % GUI_handle: handle of the GUI to be filled 10 10 % 11 11 % see also the reverse function read_GUI.m … … 14 14 %------------------------------------------------------------------------ 15 15 errormsg=''; 16 %handles=guidata(GUI_handle); 17 children=get(GUI_handle,'children'); 18 handles=[]; 19 for ichild=1:numel(children) 20 handles.(get(children(ichild),'tag'))=children(ichild); 21 end 16 if ~isstruct(Param) 17 errormsg='first input parmaeter of fill_GUI must be a structure'; 18 return 19 end 20 children=get(GUI_handle,'children'); 21 handles=[]; 22 for ichild=1:numel(children) 23 handles.(get(children(ichild),'tag'))=children(ichild); 24 end 22 25 UserData=get(GUI_handle,'UserData'); 23 26 fields=fieldnames(Param);%list of fields in Param … … 28 31 if isfield(handles,fields{ifield}) 29 32 set(handles.(fields{ifield}),'Visible','on') 30 % children=get(handles.(fields{ifield}),'children');31 % for ichild=1:numel(children)32 % hchild.(get(children(ichild),'tag'))=children(ichild);33 % end34 % errormsg=fill_GUI(Param.(fields{ifield}),hchild);% apply the function to the substructure35 33 errormsg=fill_GUI(Param.(fields{ifield}),handles.(fields{ifield}));% apply the function to the substructure 36 % if the input sub-structure fits with a tag name of the GUI and a37 % substructure of UserData38 34 elseif isfield(UserData,fields{ifield})&& isfield(handles,fields{ifield})&&isfield(Param.(fields{ifield}),'Name') 39 35 UserData.(fields{ifield})=Param.(fields{ifield}); … … 115 111 end 116 112 end 117 -
trunk/src/get_file_type.m
r595 r664 30 30 FileType='xls'; 31 31 otherwise 32 if ~isempty(FileExt) && ~isempty(imformats(regexprep(FileExt,'^.',''))) 33 try 34 imainfo=imfinfo(fileinput); 35 if length(imainfo) >1 %case of image with multiple frames 36 FileType='multimage'; 37 FileInfo=imainfo(1);%take info from the first frame 38 FileInfo.NumberOfFrames=length(imainfo); 32 if ~isempty(FileExt)% exclude empty extension 33 FileExt=regexprep(FileExt,'^.','');% eliminate the dot of the extension 34 if ~isempty(FileExt) 35 if ~isempty(imformats(FileExt))%case of images 36 try 37 imainfo=imfinfo(fileinput); 38 if length(imainfo) >1 %case of image with multiple frames 39 FileType='multimage'; 40 FileInfo=imainfo(1);%take info from the first frame 41 FileInfo.NumberOfFrames=length(imainfo); 42 else 43 FileType='image'; 44 FileInfo=imainfo; 45 FileInfo.NumberOfFrames=1; 46 end 47 end 39 48 else 40 FileType='image'; 41 FileInfo=imainfo; 42 FileInfo.NumberOfFrames=1; 43 end 44 end 45 else 46 error_nc=0; 47 try 48 Data=nc2struct(fileinput,'ListGlobalAttribute','absolut_time_T0','Conventions',... 49 'CivStage','patch2','fix2','civ2','patch','fix'); 50 if isfield(Data,'Txt') && ~isempty(Data.Txt) 51 error_nc=1; 52 else 53 if ~isempty(Data.absolut_time_T0') 54 FileType='civx'; % test for civx velocity fields 55 if ~isempty(Data.patch2) && isequal(Data.patch2,1) 56 FileInfo.CivStage=6; 57 elseif ~isempty(Data.fix2) && isequal(Data.fix2,1) 58 FileInfo.CivStage=5; 59 elseif ~isempty(Data.civ2) && isequal(Data.civ2,1); 60 FileInfo.CivStage=4; 61 elseif ~isempty(Data.patch) && isequal(Data.patch,1); 62 FileInfo.CivStage=3; 63 elseif ~isempty(Data.fix) && isequal(Data.fix,1); 64 FileInfo.CivStage=2; 65 elseif ~isempty(Data.absolut_time_T0) && ~isempty(Data.hart) 66 FileInfo.CivStage=1; 49 error_nc=0; 50 try 51 Data=nc2struct(fileinput,'ListGlobalAttribute','absolut_time_T0','Conventions',... 52 'CivStage','patch2','fix2','civ2','patch','fix'); 53 if isfield(Data,'Txt') && ~isempty(Data.Txt) 54 error_nc=1; 55 else 56 if ~isempty(Data.absolut_time_T0') 57 FileType='civx'; % test for civx velocity fields 58 if ~isempty(Data.patch2) && isequal(Data.patch2,1) 59 FileInfo.CivStage=6; 60 elseif ~isempty(Data.fix2) && isequal(Data.fix2,1) 61 FileInfo.CivStage=5; 62 elseif ~isempty(Data.civ2) && isequal(Data.civ2,1); 63 FileInfo.CivStage=4; 64 elseif ~isempty(Data.patch) && isequal(Data.patch,1); 65 FileInfo.CivStage=3; 66 elseif ~isempty(Data.fix) && isequal(Data.fix,1); 67 FileInfo.CivStage=2; 68 elseif ~isempty(Data.absolut_time_T0) && ~isempty(Data.hart) 69 FileInfo.CivStage=1; 70 end 71 elseif strcmp(Data.Conventions,'uvmat/civdata') 72 FileType='civdata'; % test for civx velocity fields 73 FileInfo.CivStage=Data.CivStage; 74 else 75 FileType='netcdf'; 76 end 67 77 end 68 elseif strcmp(Data.Conventions,'uvmat/civdata') 69 FileType='civdata'; % test for civx velocity fields 70 FileInfo.CivStage=Data.CivStage; 71 else 72 FileType='netcdf'; 78 catch ME 79 error_nc=1; 73 80 end 74 end 75 catch ME 76 error_nc=1; 77 end 78 if error_nc 79 try 80 if exist('VideoReader.m','file')%recent version of Matlab 81 VideoObject=VideoReader(fileinput); 82 FileInfo=get(VideoObject); 83 FileType='video'; 84 elseif exist('mmreader.m','file')% Matlab 2009a 85 VideoObject=mmreader(fileinput); 86 FileInfo=get(VideoObject); 87 FileType='mmreader'; 88 end 89 FileInfo.BitDepth=FileInfo.BitsPerPixel/3; 81 if error_nc 82 try 83 if exist('VideoReader.m','file')%recent version of Matlab 84 VideoObject=VideoReader(fileinput); 85 FileInfo=get(VideoObject); 86 FileType='video'; 87 elseif exist('mmreader.m','file')% Matlab 2009a 88 VideoObject=mmreader(fileinput); 89 FileInfo=get(VideoObject); 90 FileType='mmreader'; 91 end 92 FileInfo.BitDepth=FileInfo.BitsPerPixel/3; 93 end 94 end 90 95 end 91 96 end -
trunk/src/mouse_motion.m
r663 r664 57 57 test_edit_object=get(hhuvmat.CheckEditObject,'Value'); 58 58 test_ruler=isequal(get(hhuvmat.MenuRuler,'checked'),'on'); 59 test_transform=~isequal(get(hhuvmat.TransformName,'Value'),1) 59 test_transform=~isequal(get(hhuvmat.TransformName,'Value'),1); 60 60 end 61 61 test_piv=0; -
trunk/src/series.m
r654 r664 2563 2563 2564 2564 InputTable=get(handles.InputTable,'Data'); 2565 [FileName, PathName] = uigetfile( ... 2566 {'*.xml', ' (*.xml)'; 2567 '*.xml', '.xml files '; ... 2568 '*.*', 'All Files (*.*)'}, ... 2569 'Pick a file',InputTable{1,1}); 2570 filexml=[PathName FileName];%complete file name 2571 if isempty(filexml),return;end %abandon if no file is introduced by the browser 2572 Param=xml2struct(filexml); 2573 fill_GUI(Param,handles.series) 2565 filexml=uigetfile_uvmat('pick a xml parameter file',InputTable{1,1},'.xml'); 2566 % [FileName, PathName] = uigetfile( ... 2567 % {'*.xml', ' (*.xml)'; 2568 % '*.xml', '.xml files '; ... 2569 % '*.*', 'All Files (*.*)'}, ... 2570 % 'Pick a file',InputTable{1,1}); 2571 % filexml=[PathName FileName];%complete file name 2572 if ~isempty(filexml)%abandon if no file is introduced by the browser 2573 Param=xml2struct(filexml); 2574 fill_GUI(Param,handles.series) 2575 if isfield(Param,'ActionInput') 2576 set(handles.ActionInput,'Visible','on') 2577 set(handles.ActionInput_title,'Visible','on') 2578 set(handles.ActionInputView,'Visible','on') 2579 set(handles.ActionInputView,'Value',0) 2580 %set(handles.ActionInput,'String',ActionName) 2581 % ParamOut.ActionInput.Program=ActionName; % record the program in ActionInput 2582 SeriesData=get(handles.series,'UserData'); 2583 SeriesData.ActionInput=Param.ActionInput; 2584 set(handles.series,'UserData',SeriesData) 2585 end 2586 ActionName_Callback([],[],handles) 2587 end 2574 2588 2575 2589 %------------------------------------------------------------------------ -
trunk/src/uigetfile_uvmat.m
r653 r664 123 123 function OK_Callback(option,filter_ext,hObject,event) 124 124 hfig=get(hObject,'parent');%handle of the fig 125 % if ~strcmp(get(hfig,'SelectionType'),'open')126 % return %select double click127 % end128 %set(hObject,'BackgroundColor',[1 1 0])% paint list in yellow to indicate action129 % drawnow130 125 htitlebox=findobj(hfig,'tag','titlebox'); % display the current dir name 131 126 DirName=get(htitlebox,'String'); … … 135 130 list=get(hlist,'String'); 136 131 index=get(hlist,'Value'); 137 SelectName=regexprep(list{index},'^\+/','');% remove the +/ used to mark dir 132 if ~isempty(regexp(list{index},'^\+/')) 133 return % quit if a dir has been opened 134 end 135 %SelectName=regexprep(list{index},'^\+/','');% remove the +/ used to mark dir 136 SelectName=list{index}; 138 137 ind_dot=regexp(SelectName,'\s*\.\.\.');%remove what is beyond '...' 139 138 if ~isempty(ind_dot) 140 139 SelectName=SelectName(1:ind_dot-1); 141 140 end 142 % if strcmp(SelectName,'..')% the upward dir option has been selected143 % FullSelectName=fileparts(DirName);144 % else145 141 FullSelectName=fullfile(DirName,SelectName); 146 % end147 142 if exist(FullSelectName,'file') 148 143 switch option … … 164 159 end 165 160 end 166 %set(hObject,'BackgroundColor',[0.7 0.7 0.7])% paint list in grey to indicate action end167 161 168 162 uiresume(get(hObject,'parent')) … … 253 247 %------------------------------------------------------------------------ 254 248 hfig=get(hObject,'parent');%handle of the fig 255 % if ~strcmp(get(hfig,'SelectionType'),'open')256 % return %select double click257 % end258 249 set(hObject,'BackgroundColor',[1 1 0])% paint list in yellow to indicate action 259 250 drawnow
Note: See TracChangeset
for help on using the changeset viewer.