Legend:
- Unmodified
- Added
- Removed
-
trunk/src/civ.m
r36 r39 91 91 end 92 92 93 if exist('ext','var') && length(ext)>1 && (~isempty(imformats(ext( [2:end])))|...94 isequal( ext,'.avi')||isequal(ext,'.AVI'));%if an image file has been opened by uvmat93 if exist('ext','var') && length(ext)>1 && (~isempty(imformats(ext(2:end)))||... 94 isequal(lower(ext),'.avi'));%if an image file has been opened by uvmat 95 95 set(handles.ext_ima,'String',ext) 96 96 if exist('nom_type_read','var') … … 259 259 filebase=get(handles.displ_filebase,'String'); 260 260 oldfile=''; %default 261 if isempty(filebase)| isequal(filebase,'')%loads the previously stored file name and set it as default in the file_input box261 if isempty(filebase)|| isequal(filebase,'')%loads the previously stored file name and set it as default in the file_input box 262 262 dir_perso=prefdir; 263 263 profil_perso=fullfile(dir_perso,'uvmat_perso.mat'); … … 448 448 field_count=1;%default 449 449 nom_type_nc=[]; 450 npx=[];%default451 npy=[];450 % npx=[];%default 451 % npy=[]; 452 452 time=[]; 453 453 TimeUnit=[]; %default … … 478 478 end 479 479 first_j=str2num(get(handles.first_j,'String')); 480 if isempty(first_j)| first_j < 1480 if isempty(first_j)|| first_j < 1 481 481 first_j=1; %default first_j 482 482 end 483 483 last_j=str2num(get(handles.last_j,'String')); 484 if isempty(last_j)| last_j < first_j484 if isempty(last_j)|| last_j < first_j 485 485 last_j=first_j; %default last_j 486 486 end 487 487 incr_i=str2num(get(handles.incr_i,'String')); 488 if isempty(incr_i) | incr_i < 1;488 if isempty(incr_i) || incr_i < 1; 489 489 set(handles.incr_i,'String','1') %default incr_i 490 490 end 491 491 incr_j=str2num(get(handles.incr_j,'String')); 492 if isempty(incr_j) | incr_j < 1;492 if isempty(incr_j) || incr_j < 1; 493 493 set(handles.incr_j,'String','1') %default incr_j 494 494 end … … 554 554 if isfield(XmlData,'Heading')&&isfield(XmlData.Heading','ImageName')&&ischar(XmlData.Heading.ImageName)% get image nom type and extension from the xml file 555 555 [PP,FF,fc,str2,str_a,str_b,ext_ima_read,nom_type_read]=name2display(XmlData.Heading.ImageName); 556 fullname=fullfile(fileparts(filebase),XmlData.Heading.ImageName) %full name (including path) of the first image defined by the xmle file,556 fullname=fullfile(fileparts(filebase),XmlData.Heading.ImageName); %full name (including path) of the first image defined by the xmle file, 557 557 if exist(fullname,'file') 558 558 testima_xml=1; … … 1318 1318 last_i=str2num(get(handles.last_i,'String'));%last index i 1319 1319 incr=str2num(get(handles.incr_i,'String'));% increment 1320 num 1=[first_i:incr:last_i];% list of i indices (reference values for each pair)1320 num_i=[first_i:incr:last_i];% list of i indices (reference values for each pair) 1321 1321 if isequal(get(handles.first_j,'Visible'),'on') 1322 1322 first_j=str2num(get(handles.first_j,'String'));%first index j … … 1331 1331 list_civ1=get(handles.list_pair_civ1,'String'); 1332 1332 index_civ1=get(handles.list_pair_civ1,'Value'); 1333 [num_i,num_j]=meshgrid(num_i,num_j); 1333 1334 str_civ1=list_civ1{index_civ1};%string defining the image pairs for civ1 1334 1335 if isempty(str_civ1)||isequal(str_civ1,'') … … 1345 1346 if isempty(first_i)||isempty(first_j), msgbox_uvmat('ERROR','first field number not defined'),... 1346 1347 return,end; 1347 if isequal(last_i,[])| isequal(last_j,[]),msgbox_uvmat('ERROR','last field number not defined'),...1348 if isequal(last_i,[])|| isequal(last_j,[]),msgbox_uvmat('ERROR','last field number not defined'),... 1348 1349 return,end; 1349 if isequal(incr,[])| isequal(incr_j,[]),msgbox_uvmat('ERROR','increment in field number not defined'),...1350 if isequal(incr,[])|| isequal(incr_j,[]),msgbox_uvmat('ERROR','increment in field number not defined'),... 1350 1351 return,end; 1351 if last_i < first_i | last_j < first_j , msgbox_uvmat('ERROR','last field number must be larger than the first one'),...1352 if last_i < first_i || last_j < first_j , msgbox_uvmat('ERROR','last field number must be larger than the first one'),... 1352 1353 return,end; 1353 1354 if isequal (mode,'series(Di)') … … 1362 1363 d2=str2num(str_civ1([indsel(indsepar)+1:indsel(indsepar+1)-1])); 1363 1364 end 1364 num1_civ1=num 1-d1;% set of first image numbers1365 num2_civ1=num 1+d2;1365 num1_civ1=num_i-d1;% set of first image numbers 1366 num2_civ1=num_i+d2; 1366 1367 num_a_civ1=num_j; 1367 1368 num_b_civ1=num_j; … … 1378 1379 end 1379 1380 if isempty(d1) 1380 num1_civ2=num 1;1381 num1_civ2=num_i; 1381 1382 else 1382 num1_civ2=num 1-d1;% set of first image numbers1383 num1_civ2=num_i-d1;% set of first image numbers 1383 1384 end 1384 1385 if isempty(d2) 1385 num2_civ2=num 1;1386 num2_civ2=num_i; 1386 1387 else 1387 num2_civ2=num 1+d2;1388 num2_civ2=num_i+d2; 1388 1389 end 1389 1390 num_a_civ2=num_j; … … 1400 1401 firstind=indsel(1); 1401 1402 lastind=indsel(end); 1402 set(handles.first_i,'String',num2str(num 1(firstind)))%update the display of first and last fields1403 set(handles.last_i,'String',num2str(num 1(lastind)))1404 num 1=num1(indsel);1403 set(handles.first_i,'String',num2str(num_i(firstind)))%update the display of first and last fields 1404 set(handles.last_i,'String',num2str(num_i(lastind))) 1405 num_i=num_i(indsel); 1405 1406 num1_civ1=num1_civ1(indsel); 1406 1407 num1_civ2=num1_civ2(indsel); … … 1410 1411 elseif isequal (mode,'series(Dj)') 1411 1412 lastfield_j=str2num(get(handles.nb_field2,'String')); 1412 num1_civ1=num 1;% set of first image numbers1413 num2_civ1=num 1;1413 num1_civ1=num_i;% set of first image numbers 1414 num2_civ1=num_i; 1414 1415 num_a_civ1=num_j-floor(index_civ1/2)*ones(size(num_j)); 1415 1416 num_b_civ1=num_j+ceil(index_civ1/2)*ones(size(num_j)); 1416 num1_civ2=num 1;1417 num2_civ2=num 1;1417 num1_civ2=num_i; 1418 num2_civ2=num_i; 1418 1419 num_a_civ2=num_j-floor(index_civ2/2)*ones(size(num_j)); 1419 1420 num_b_civ2=num_j+ceil(index_civ2/2)*ones(size(num_j)); … … 1436 1437 end 1437 1438 elseif isequal(mode,'pair j1-j2') %case of bursts (png_old or png_2D) 1438 num1_civ1=num 1;1439 num1_civ2=num 1;1439 num1_civ1=num_i; 1440 num1_civ2=num_i; 1440 1441 displ_num=get(handles.list_pair_civ1,'UserData'); 1441 num2_civ1=num 1;1442 num2_civ1=num_i; 1442 1443 num_a_civ1=displ_num(1,index_civ1); 1443 1444 num_b_civ1=displ_num(2,index_civ1); 1444 num2_civ2=num 1;1445 num2_civ2=num_i; 1445 1446 num_a_civ2=displ_num(1,index_civ2); 1446 1447 num_b_civ2=displ_num(2,index_civ2); 1447 1448 elseif isequal(mode,'displacement') 1448 num1_civ1=num 1;1449 num2_civ1=num 1;1449 num1_civ1=num_i; 1450 num2_civ1=num_i; 1450 1451 num_a_civ1=num_j; 1451 1452 num_b_civ1=num_j; 1452 num1_civ2=num 1;1453 num2_civ2=num 1;1453 num1_civ2=num_i; 1454 num2_civ2=num_i; 1454 1455 num_a_civ2=num_j; 1455 1456 num_b_civ2=num_j; 1456 1457 end 1457 'TESTfind'1458 num1_civ11459 num2_civ11460 num_a_civ11461 num_b_civ11462 1458 1463 1459 %------------------------------------------------------------------------ … … 1664 1660 [filecell,num1_civ1,num2_civ1,num_a_civ1,num_b_civ1,num1_civ2,num2_civ2,num_a_civ2,num_b_civ2,nom_type_nc,file_ref_fix1,file_ref_fix2]=... 1665 1661 set_civ_filenames(handles,compare,box_test); 1666 'TESTnbre_RUN' 1667 nbfield=size(num1_civ1,2) 1668 nbslice=size(num1_civ1,1) 1662 nbfield=size(num1_civ1,2); 1663 nbslice=size(num1_civ1,1); 1669 1664 1670 1665 if isempty(filecell) … … 2185 2180 set_civ_filenames(handles,compare,box_test); 2186 2181 display('files OK, processing...') 2187 'TESTnbre' 2188 nbfield=size(num1_civ1,2) 2189 nbslice=size(num1_civ1,1) 2182 nbfield=size(num1_civ1,2); 2183 nbslice=size(num1_civ1,1); 2190 2184 2191 2185 %GET PARAMETERS: … … 2678 2672 cmd=char({cmd;[Civ_exe ' -f ' [filename_cmx([1:end-4]) '.xml'] ' ' civAllCmd]}); 2679 2673 end 2680 2681 2674 % create the .bat file: 2682 2675 if sge … … 2688 2681 filename_bat(end-2:end)='bat'; 2689 2682 fid=fopen(filename_bat,'w'); 2690 fprintf(fid,cmd) 2691 fclose(fid) 2683 fprintf(fid,cmd); 2684 fclose(fid); 2692 2685 %dlmwrite(filename_bat,cmd,'');%write commands in filename_bat 2693 2686 if sge … … 2772 2765 [num1_civ1,num2_civ1,num_a_civ1,num_b_civ1,num1_civ2,num2_civ2,num_a_civ2,num_b_civ2]=... 2773 2766 find_pair_indices(handles,mode); 2774 2775 2767 %determine the new filebase for 'displacement' mode (comparison of two series) 2776 2768 filebase_B=filebase;% root name of the second field series for stereo … … 3458 3450 term_b=num2stra(num_b(j),nom_type_nc);% 3459 3451 if test_grid && ~isempty(nbslice_grid) 3460 num1_grid=mod(num1(ifile)-1,nbslice_grid)+1 3452 num1_grid=mod(num1(ifile)-1,nbslice_grid)+1; 3461 3453 gridname=[filebase '_' name_generator(gridname,num1_grid,1,'.grid','_i')]; 3462 3454 if ~exist(gridname,'file') … … 3652 3644 filename_nc1([end-2:end])=[]; % remove '.nc' 3653 3645 if test_grid && ~isempty(nbslice_grid) 3654 num1_grid=mod(num1(ifile)-1,nbslice_grid)+1 3646 num1_grid=mod(num1(ifile)-1,nbslice_grid)+1; 3655 3647 gridname=[filebase '_' name_generator(gridname,num1_grid,1,'.grid','_i')]; 3656 3648 if ~exist(gridname,'file') … … 4214 4206 if value 4215 4207 filebase=get(handles.displ_filebase,'String'); 4216 [nbslice, flag_grid]=get_grid(filebase,handles) 4208 [nbslice, flag_grid]=get_grid(filebase,handles); 4217 4209 if isequal(flag_grid,1) 4218 4210 filegrid=[num2str(nbslice) 'grid']; … … 4264 4256 if value 4265 4257 filebase=get(handles.displ_filebase,'String'); 4266 [nbslice, flag_grid]=get_grid(filebase,handles) 4258 [nbslice, flag_grid]=get_grid(filebase,handles); 4267 4259 if isequal(flag_grid,1) 4268 4260 mask_displ=[num2str(nbslice) 'grid']; -
trunk/src/series.m
r38 r39 6 6 %INPUT 7 7 % param: structure with input parameters (link with the GUI uvmat) 8 % .menu_coord_str: string for the CoordType(menu for coordinate transforms)9 % .menu_coord_val: value for CoordType(menu for coordinate transforms)8 % .menu_coord_str: string for the transform_fct (menu for coordinate transforms) 9 % .menu_coord_val: value for transform_fct (menu for coordinate transforms) 10 10 % .FileName: input file name 11 11 % .FileName_1: second input file name … … 96 96 %file name and browser initialisation 97 97 if isfield(param,'menu_coord_str') 98 set(handles. CoordType,'String',param.menu_coord_str)98 set(handles.transform_fct,'String',param.menu_coord_str) 99 99 end 100 100 if isfield(param,'menu_coord_val') 101 set(handles. CoordType,'Value',param.menu_coord_val);102 else 103 set(handles. CoordType,'Value',1);%default101 set(handles.transform_fct,'Value',param.menu_coord_val); 102 else 103 set(handles.transform_fct,'Value',1);%default 104 104 end 105 105 … … 132 132 NomType_Callback(hObject, eventdata, handles) 133 133 134 %loads the information stored in prefdir to initiate the browser and the list offunctions134 %loads the information stored in prefdir to initiate the list of ACTION functions 135 135 fct_menu={'check_files';'aver_stat';'time_series';'merge_proj';'clean_civ_cmx'}; 136 136 transform_menu={'';'phys';'px';'phys_polar'}; … … 139 139 [path_series,name,ext]=fileparts(which('series')); 140 140 path_series=fullfile(path_series,'series');%path of the function 'series' 141 path_transform=fullfile(path_series,'transform_field');%path of the f unction 'series'141 path_transform=fullfile(path_series,'transform_field');%path of the field transform functions 142 142 for ilist=1:length(fct_menu) 143 143 fct_path{ilist,1}=path_series;%paths of the fuctions buil-in in 'series.m' 144 144 end 145 for ilist=1:length(transform_menu) 146 transform_path{ilist,1}=path_transform; 147 end 145 146 %TRANSFORM menu: loads the information stored in prefdir to initiate the list of field transform functions 147 menu_str={'';'phys';'px';'phys_polar'}; 148 nb_builtin=numel(menu_str); %number of functions 149 [path_uvmat,name,ext]=fileparts(which('uvmat')); 150 addpath(fullfile(path_uvmat,'transform_field')) 151 fct_handle{1,1}=[]; 152 testexist(1)=1; 153 for ilist=2:length(menu_str) 154 if exist(menu_str{ilist},'file') 155 fct_handle{ilist,1}=str2func(menu_str{ilist}); 156 testexist(ilist)=1; 157 else 158 testexist(ilist)=0; 159 end 160 end 161 rmpath(fullfile(path_uvmat,'transform_field')) 162 148 163 % read the list of functions stored in the personal file 'uvmat_perso.mat' in prefdir 149 164 dir_perso=prefdir; … … 159 174 end 160 175 if isfield(h,'transform_fct') && iscell(h.transform_fct) 161 for ilist=1:length(h.transform_fct)176 for ilist=1:length(h.transform_fct); 162 177 [path,file]=fileparts(h.transform_fct{ilist}); 163 transform_path=[transform_path; {path}];%concatene the list of paths 164 transform_menu=[transform_menu;{file}]; 165 end 178 addpath(path) 179 if exist(file,'file') 180 h_func=str2func(file); 181 testexist=[testexist 1]; 182 else 183 h_func=[]; 184 testexist=[testexist 0]; 185 end 186 fct_handle=[fct_handle; {h_func}];%concatene the list of paths 187 rmpath(path) 188 menu_str=[menu_str; {file}]; 189 end 166 190 end 167 191 end … … 169 193 set(handles.ACTION,'String',fct_menu) 170 194 set(handles.ACTION,'UserData',fct_path)% store the list of path in UserData of ACTION 171 transform_menu=[transform_menu;{'more...'}]; 172 set(handles.CoordType,'String',transform_menu) 173 set(handles.CoordType,'UserData',transform_path)% store the list of path in UserData of ACTION 195 196 menu_str=menu_str(find(testexist)); 197 fct_handle=fct_handle(find(testexist)); 198 menu_str=[menu_str;{'more...'}]; 199 set(handles.transform_fct,'String',menu_str) 200 set(handles.transform_fct,'UserData',fct_handle)% store the list of path in UserData of ACTION 174 201 175 202 % display the GUI for the default action 'check_files' … … 544 571 testveltype=isequal(get(handles.VelTypeMenu,'enable'),'on'); 545 572 testveltype_1=isequal(get(handles.VelTypeMenu_1,'enable'),'on'); 546 testtransform=isequal(get(handles. CoordType,'Enable'),'on');573 testtransform=isequal(get(handles.transform_fct,'Enable'),'on'); 547 574 testnc=0; 548 575 testnc_1=0; … … 962 989 function view_TRANSFORM(handles,state) 963 990 set(handles.TRANSFORM_frame,'Visible',state) 964 set(handles. CoordType,'Visible',state);991 set(handles.transform_fct,'Visible',state); 965 992 set(handles.TRANSFORM_title,'Visible',state) 966 993 … … 1328 1355 Series.Field=FieldMenu(FieldValue); 1329 1356 end 1330 menu_coord_state=get(handles. CoordType,'Visible');1357 menu_coord_state=get(handles.transform_fct,'Visible'); 1331 1358 Series.CoordType='';%default 1332 1359 if isequal(menu_coord_state,'on') 1333 menu_coord=get(handles. CoordType,'String');1334 menu_index=get(handles. CoordType,'Value');1360 menu_coord=get(handles.transform_fct,'String'); 1361 menu_index=get(handles.transform_fct,'Value'); 1335 1362 Series.CoordType=menu_coord{menu_index}; 1336 1363 end … … 1593 1620 path_series=which('series');%path to series.m 1594 1621 list_path=get(handles.ACTION,'UserData');%list of recorded paths to functions of the list ACTION 1595 1622 default_file=fullfile(list_path{end},ACTION); 1596 1623 % add a new function to the menu if the selected item is 'more...' 1597 1624 if isequal(ACTION,'more...') 1598 1625 pathfct=fileparts(path_series); 1599 % browse_name=fullfile(path_series,'series');%go to UVMAT/series by default1600 % if length(list_path)>nb_builtin1601 % browse_name=list_path{end};% initialize browser with the path of the last introduced function1602 % end1603 1626 [FileName, PathName, filterindex] = uigetfile( ... 1604 1627 {'*.m', ' (*.m)'; 1605 1628 '*.m', '.m files '; ... 1606 1629 '*.*', 'All Files (*.*)'}, ... 1607 'Pick a file', list_path{end});1630 'Pick a file',default_file); 1608 1631 if length(FileName)<2 1609 1632 return … … 1685 1708 set(handles.FieldMenu_1,'Enable','off') 1686 1709 set(handles.VelTypeMenu_1,'Enable','off') 1687 set(handles. CoordType,'Enable','off')1710 set(handles.transform_fct,'Enable','off') 1688 1711 %set the displayed GUI item needed for input parameters 1689 1712 %list_input=feval(ACTION);% input list asked by the selected function … … 1789 1812 case 'CoordType' %hidden by default 1790 1813 if isequal(lower(varargout{ilist+1}),'on') 1791 set(handles. CoordType,'Enable','on')1814 set(handles.transform_fct,'Enable','on') 1792 1815 view_TRANSFORM(handles,'on') 1793 1816 end … … 2110 2133 else 2111 2134 siz=size(times); 2112 if siz(1)>=last_i & siz(2)>=last_j2135 if siz(1)>=last_i && siz(2)>=last_j && first_i>=1 && first_j>=1 2113 2136 time_first=times(first_i,first_j); 2114 2137 time_last=times(last_i,last_j); … … 2188 2211 2189 2212 2190 2191 2192 2193 2213 % --- Executes on selection change in transform_fct. 2214 function transform_fct_Callback(hObject, eventdata, handles) 2215 2216 global nb_transform 2217 2218 % huvmat=get(handles.transform_fct,'parent'); 2219 menu=get(handles.transform_fct,'String'); 2220 ind_coord=get(handles.transform_fct,'Value'); 2221 coord_option=menu{ind_coord}; 2222 list_transform=get(handles.transform_fct,'UserData') 2223 ff=functions(list_transform{end}); 2224 if isequal(coord_option,'more...'); 2225 coord_fct=''; 2226 prompt = {'Enter the name of the transform function'}; 2227 dlg_title = 'user defined transform'; 2228 num_lines= 1; 2229 [FileName, PathName, filterindex] = uigetfile( ... 2230 {'*.m', ' (*.m)'; 2231 '*.m', '.m files '; ... 2232 '*.*', 'All Files (*.*)'}, ... 2233 'Pick a file', ff.file); 2234 if isequal(PathName(end),'/')||isequal(PathName(end),'\') 2235 PathName(end)=[]; 2236 end 2237 transform_selected =fullfile(PathName,FileName); 2238 if ~exist(transform_selected,'file') 2239 return 2240 end 2241 [ppp,transform,xt_fct]=fileparts(FileName);% removes extension .m 2242 if ~isequal(ext_fct,'.m') 2243 msgbox_uvmat('ERROR','a Matlab function .m must be introduced'); 2244 return 2245 end 2246 menu=update_menu(handles.transform_fct,transform);%add the selected fct to the menu 2247 ind_coord=get(handles.transform_fct,'Value'); 2248 addpath(PathName) 2249 list_transform{ind_coord}=str2func(transform);% create the function handle corresponding to the newly seleced function 2250 set(handles.transform_fct,'UserData',list_transform) 2251 rmpath(PathName) 2252 % save the new menu in the personal file 'uvmat_perso.mat' 2253 dir_perso=prefdir;%personal Matalb directory 2254 profil_perso=fullfile(dir_perso,'uvmat_perso.mat'); 2255 if exist(profil_perso,'file') 2256 for ilist=nb_transform+1:numel(list_transform) 2257 ff=functions(list_transform{ilist}) 2258 transform_fct{ilist-nb_transform}=ff.file; 2259 end 2260 save (profil_perso,'transform_fct','-append'); %store the root name for future opening of uvmat 2261 end 2262 end 2263 2264 %check the current path to the selected function 2265 func=functions(list_transform{ind_coord}); 2266 set(handles.path_transform,'String',fileparts(func.file)); %show the path to the senlected function 2267 2268 2269 2270 function path_transform_Callback(hObject, eventdata, handles) 2271 % hObject handle to path_transform (see GCBO) 2272 % eventdata reserved - to be defined in a future version of MATLAB 2273 % handles structure with handles and user data (see GUIDATA) 2274 2275 % Hints: get(hObject,'String') returns contents of path_transform as text 2276 % str2double(get(hObject,'String')) returns contents of path_transform as a double 2277 2278 2279 % --- Executes during object creation, after setting all properties. 2280 function path_transform_CreateFcn(hObject, eventdata, handles) 2281 % hObject handle to path_transform (see GCBO) 2282 % eventdata reserved - to be defined in a future version of MATLAB 2283 % handles empty - handles not created until after all CreateFcns called 2284 2285 % Hint: edit controls usually have a white background on Windows. 2286 % See ISPC and COMPUTER. 2287 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) 2288 set(hObject,'BackgroundColor','white'); 2289 end 2290 2291 -
trunk/src/uvmat.m
r38 r39 195 195 %------------------------------------------------------------------- 196 196 %WARNING: avoid the second input parameter, leads to erros 197 global dircur dir_opening 197 global dircur dir_opening nb_builtin 198 198 % Choose default command menuline output for uvmat 199 199 handles.output = hObject; … … 221 221 set(hObject,'WindowButtonDownFcn',{'mouse_down'})%set mouse click action function 222 222 set(hObject,'WindowButtonUpFcn',{'mouse_up',handles}) 223 %set(hObject,'ResizeFcn',{@resize_uvmat}) 223 224 %TRANSFORM menu: loads the information stored in prefdir to initiate the browser and the list of functions 225 menu_str={'';'phys';'px';'phys_polar'}; 226 nb_builtin=numel(menu_str); %number of functions 227 [path_uvmat,name,ext]=fileparts(which('uvmat')); 228 addpath(fullfile(path_uvmat,'transform_field')) 229 fct_handle{1,1}=[]; 230 testexist(1)=1; 231 for ilist=2:length(menu_str) 232 if exist(menu_str{ilist},'file') 233 fct_handle{ilist,1}=str2func(menu_str{ilist}); 234 testexist(ilist)=1; 235 else 236 testexist(ilist)=0; 237 end 238 % fct_handle{ilist,1}=fullfile(path_uvmat,'transform_field');%path to the transform functions path_transform; 239 end 240 rmpath(fullfile(path_uvmat,'transform_field')) 224 241 225 242 %load the list of previously browsed files in menus Open and Open_1 … … 247 264 set(handles.MenuFile_5,'Label',h.MenuFile_5); 248 265 set(handles.MenuFile_5_1,'Label',h.MenuFile_5); 249 end 266 end 267 if isfield(h,'transform_fct') && iscell(h.transform_fct) 268 for ilist=1:length(h.transform_fct); 269 [path,file]=fileparts(h.transform_fct{ilist}); 270 addpath(path) 271 if exist(file,'file') 272 h_func=str2func(file); 273 testexist=[testexist 1]; 274 else 275 h_func=[]; 276 testexist=[testexist 0]; 277 end 278 fct_handle=[fct_handle; {h_func}];%concatene the list of paths 279 rmpath(path) 280 menu_str=[menu_str; {file}]; 281 end 282 end 250 283 end 284 menu_str=menu_str(find(testexist)); 285 fct_handle=fct_handle(find(testexist)); 286 menu_str=[menu_str;{'more...'}]; 287 set(handles.transform_fct,'String',menu_str) 288 set(handles.transform_fct,'UserData',fct_handle)% store the list of path in UserData of ACTION 251 289 252 290 %initiates menu of vector colors … … 259 297 [errormsg,date_str]=check_functions;%check the path of the functions called by uvmat.m 260 298 261 %check the path of menu_coordtransform262 %set(handles. menu_coord,'String',{'';'phys';'px';'more...'})299 %check the path of transform_fct transform 300 %set(handles.transform_fct,'String',{'';'phys';'px';'more...'}) 263 301 % path_fct{1}=''; 264 302 % path_fct{2}=fileparts(path_to_uvmat); 265 303 % path_fct{3}=fileparts(path_to_uvmat); 266 304 % path_fct{4}=fileparts(path_to_uvmat); 267 % set(handles. menu_coord,'UserData',path_fct)305 % set(handles.transform_fct,'UserData',path_fct) 268 306 269 307 %case of an input argument for uvmat … … 303 341 if ~isempty(Field) 304 342 set(handles.Fields,'Value',1) 305 set(handles.Fields,'String',{'get_field...'}) 306 % set(handles.Fields,'Value',2)% option 'get_field...' 343 set(handles.Fields,'String',{'get_field...'}) 307 344 set(handles.Fields,'UserData',Field) 308 345 testinputfield=1; … … 344 381 end 345 382 end 346 347 %TRANSFORM menu: loads the information stored in prefdir to initiate the browser and the list of functions348 menu_str={'';'phys';'px';'phys_polar'};349 nb_builtin=numel(menu_str); %number of functions350 [path_uvmat,name,ext]=fileparts(which('uvmat'));351 addpath(fullfile(path_uvmat,'transform_field'))352 fct_handle{1,1}=[];353 testexist(1)=1;354 for ilist=2:length(menu_str)355 if exist(menu_str{ilist},'file')356 fct_handle{ilist,1}=str2func(menu_str{ilist});357 testexist(ilist)=1;358 else359 testexist(ilist)=0;360 end361 % fct_handle{ilist,1}=fullfile(path_uvmat,'transform_field');%path to the transform functions path_transform;362 end363 rmpath(fullfile(path_uvmat,'transform_field'))364 % read the list of functions stored in the personal file 'uvmat_perso.mat' in prefdir365 dir_perso=prefdir;366 profil_perso=fullfile(dir_perso,'uvmat_perso.mat');367 if exist(profil_perso,'file')368 h=load (profil_perso);369 if isfield(h,'transform_fct') && iscell(h.transform_fct)370 for ilist=1:length(h.transform_fct)371 [path,file]=fileparts(h.transform{ilist});372 addpath(path)373 if exist(file,'file')374 h_func=str2func(path);375 testexist=[testexist 1];376 else377 h_func=[];378 testexist=[testexist 0];379 end380 fct_handle=[fct_handle; {h_func}];%concatene the list of paths381 rmpath(path)382 % fct_path=[fct_path; {path}];%concatene the list of paths383 menu_str=[menu_str; {file}];384 end385 end386 end387 menu_str=menu_str(find(testexist));388 fct_handle=fct_handle(find(testexist));389 menu_str=[menu_str;{'more...'}];390 set(handles.menu_coord,'String',menu_str)391 set(handles.menu_coord,'UserData',fct_handle)% store the list of path in UserData of ACTION392 383 393 384 set_vec_col_bar(handles) … … 790 781 set(handles.pxcm,'String','') 791 782 set(handles.pycm,'String','') 792 set(handles. menu_coord,'Value',1); % no transform by default783 set(handles.transform_fct,'Value',1); % no transform by default 793 784 else 794 785 if (isfield(GeometryCalib,'R')& ~isequal(GeometryCalib.R(2,1),0) & ~isequal(GeometryCalib.R(1,2),0)) |... … … 802 793 set(handles.pycm,'String',num2str(pixcmy)) 803 794 end 804 set(handles. menu_coord,'Value',2); % phys transform by default795 set(handles.transform_fct,'Value',2); % phys transform by default 805 796 if isfield(GeometryCalib,'SliceCoord') 806 797 siz=size(GeometryCalib.SliceCoord); … … 1516 1507 end 1517 1508 %px to phys or other transform on field 1518 menu_transform=get(handles. menu_coord,'String');1519 choice_value=get(handles. menu_coord,'Value');1520 transform_name=menu_transform{choice_value};%name of the transform fct given by the menu ' menu_coord'1521 transform_list=get(handles. menu_coord,'UserData');1509 menu_transform=get(handles.transform_fct,'String'); 1510 choice_value=get(handles.transform_fct,'Value'); 1511 transform_name=menu_transform{choice_value};%name of the transform fct given by the menu 'transform_fct' 1512 transform_list=get(handles.transform_fct,'UserData'); 1522 1513 transform=transform_list{choice_value}; 1523 1514 if ~isequal(transform_name,'') && ~isequal(transform_name,'px') … … 1750 1741 1751 1742 %px to phys or other transform on field 1752 menu_transform=get(handles. menu_coord,'String');1753 choice_value=get(handles. menu_coord,'Value');1754 transform_name=menu_transform{choice_value};%name of the transform fct given by the menu ' menu_coord'1755 transform_list=get(handles. menu_coord,'UserData');1743 menu_transform=get(handles.transform_fct,'String'); 1744 choice_value=get(handles.transform_fct,'Value'); 1745 transform_name=menu_transform{choice_value};%name of the transform fct given by the menu 'transform_fct' 1746 transform_list=get(handles.transform_fct,'UserData'); 1756 1747 transform=transform_list{choice_value}; 1757 1748 if ~isequal(transform_name,'') && ~isequal(transform_name,'px') … … 2034 2025 [Field{2},var_detect]=nc2struct(filename_1,SubField.ListVarName); %read the corresponding input data 2035 2026 Field{2}.VarAttribute=SubField.VarAttribute; 2036 % if isequal(get(hhget_field. menu_coord,'Visible'),'on')2037 % list_transform=get(hhget_field. menu_coord,'String');2038 % val_list=get(hhget_field. menu_coord,'Value');2027 % if isequal(get(hhget_field.transform_fct,'Visible'),'on') 2028 % list_transform=get(hhget_field.transform_fct,'String'); 2029 % val_list=get(hhget_field.transform_fct,'Value'); 2039 2030 % transf=list_transform{val_list}; 2040 2031 % if ~isempty(transf) … … 2171 2162 XmlData_1=UvData.XmlData_1; 2172 2163 end 2173 menu_transform=get(handles. menu_coord,'String');2174 choice_value=get(handles. menu_coord,'Value');2175 %transform=menu_transform{choice_value};%name of the transform fct given by the menu ' menu_coord'2176 transform_list=get(handles. menu_coord,'UserData')2177 transform=transform_list{choice_value} %selected function handles2164 menu_transform=get(handles.transform_fct,'String'); 2165 choice_value=get(handles.transform_fct,'Value'); 2166 %transform=menu_transform{choice_value};%name of the transform fct given by the menu 'transform_fct' 2167 transform_list=get(handles.transform_fct,'UserData'); 2168 transform=transform_list{choice_value};%selected function handles 2178 2169 2179 2170 % z index … … 2190 2181 end 2191 2182 else 2192 'TESTrun'2193 2183 Field{1}=transform(Field{1},XmlData); 2194 Field{1}2195 2184 end 2196 2185 end … … 4003 3992 4004 3993 %------------------------------------------------------------- 4005 % --- Executes on selection change in menu_coord.4006 function menu_coord_Callback(hObject, eventdata, handles)3994 % --- Executes on selection change in transform_fct. 3995 function transform_fct_Callback(hObject, eventdata, handles) 4007 3996 %------------------------------------------------------------- 4008 huvmat=get(handles.menu_coord,'parent'); 4009 menu=get(handles.menu_coord,'String'); 4010 ind_coord=get(handles.menu_coord,'Value'); 3997 global nb_builtin 3998 3999 huvmat=get(handles.transform_fct,'parent'); 4000 menu=get(handles.transform_fct,'String'); 4001 ind_coord=get(handles.transform_fct,'Value'); 4011 4002 coord_option=menu{ind_coord}; 4012 list_transform=get(handles. menu_coord,'UserData');4013 4003 list_transform=get(handles.transform_fct,'UserData'); 4004 ff=functions(list_transform{end}) 4014 4005 if isequal(coord_option,'more...'); 4015 4006 coord_fct=''; 4016 dir_perso=prefdir; 4017 profil_perso=fullfile(dir_perso,'uvmat_perso.mat'); 4018 if exist(profil_perso,'file') 4019 h=load (profil_perso); 4020 if isfield(h,'coord_fct') 4021 coord_fct=h.coord_fct; 4022 end 4023 end 4007 4008 % if exist(profil_perso,'file') 4009 % h=load (profil_perso); 4010 % if isfield(h,'transform_fct') 4011 % transform_fct=h.transform_fct; 4012 % end 4013 % end 4024 4014 prompt = {'Enter the name of the transform function'}; 4025 4015 dlg_title = 'user defined transform'; … … 4029 4019 '*.m', '.m files '; ... 4030 4020 '*.*', 'All Files (*.*)'}, ... 4031 'Pick a file', coord_fct);4021 'Pick a file', ff.file); 4032 4022 if isequal(PathName(end),'/')||isequal(PathName(end),'\') 4033 4023 PathName(end)=[]; 4034 4024 end 4035 coord_fct=fullfile(PathName,FileName); 4036 if ~exist(coord_fct,'file') 4037 msgbox_uvmat('ERROR',['image procesing fct ' coord_fct ' not found']) 4038 else 4039 [ppp,transform]=fileparts(FileName);% removes extension .m 4040 menu=update_menu(handles.menu_coord,transform);%add the selected fct to the menu 4041 ind_coord=get(handles.menu_coord,'Value'); 4042 addpath(PathName) 4043 list_transform{ind_coord}=str2func(transform);% create the function handle corresponding to the newly seleced function 4044 set(handles.menu_coord,'UserData',list_transform) 4045 rmpath(PathName) 4046 if exist(profil_perso,'file') 4047 save (profil_perso,'coord_fct','-append'); %store the root name for future opening of uvmat 4048 end 4049 end 4025 transform_selected =fullfile(PathName,FileName); 4026 if ~exist(transform_selected,'file') 4027 % msgbox_uvmat('ERROR',['procesing fct ' transform_selected ' not found']) 4028 return 4029 end 4030 [ppp,transform,ext_fct]=fileparts(FileName);% removes extension .m 4031 if ~isequal(ext_fct,'.m') 4032 msgbox_uvmat('ERROR','a Matlab function .m must be introduced'); 4033 return 4034 end 4035 menu=update_menu(handles.transform_fct,transform);%add the selected fct to the menu 4036 ind_coord=get(handles.transform_fct,'Value'); 4037 addpath(PathName) 4038 list_transform{ind_coord}=str2func(transform);% create the function handle corresponding to the newly seleced function 4039 set(handles.transform_fct,'UserData',list_transform) 4040 rmpath(PathName) 4041 % save the new menu in the personal file 'uvmat_perso.mat' 4042 dir_perso=prefdir;%personal Matalb directory 4043 profil_perso=fullfile(dir_perso,'uvmat_perso.mat'); 4044 if exist(profil_perso,'file') 4045 for ilist=nb_builtin+1:numel(list_transform) 4046 ff=functions(list_transform{ilist}); 4047 transform_fct{ilist-nb_builtin}=ff.file; 4048 end 4049 save (profil_perso,'transform_fct','-append'); %store the root name for future opening of uvmat 4050 end 4050 4051 end 4051 4052 4052 4053 %check the current path to the selected function 4053 func=functions(list_transform{ind_coord}) 4054 func=functions(list_transform{ind_coord}); 4054 4055 set(handles.path_transform,'String',fileparts(func.file)); %show the path to the senlected function 4055 4056 %CurrentPath=fileparts(which(coord_option)); … … 4808 4809 param.filter1=get(handles.filter1,'Value'); 4809 4810 param.filter2=get(handles.filter2,'Value'); 4810 param.menu_coord_str=get(handles. menu_coord,'String');4811 param.menu_coord_val=get(handles. menu_coord,'Value');4811 param.menu_coord_str=get(handles.transform_fct,'String'); 4812 param.menu_coord_val=get(handles.transform_fct,'Value'); 4812 4813 4813 4814 series(param); %run the series interface … … 4862 4863 %-------------------------------------------------------------------------- 4863 4864 function enable_transform(handles,state) 4864 set(handles. menu_coord,'Visible',state)4865 set(handles.transform_fct,'Visible',state) 4865 4866 set(handles.TRANSFORM_txt,'Visible',state) 4866 set(handles. menu_coord,'Visible',state)4867 set(handles.transform_fct,'Visible',state) 4867 4868 set(handles.path_transform,'Visible',state) 4868 4869 set(handles.pxcmx_txt,'Visible',state)
Note: See TracChangeset
for help on using the changeset viewer.