Changeset 764
- Timestamp:
- May 2, 2014, 2:03:44 AM (11 years ago)
- Location:
- trunk/src
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/get_field.m
r756 r764 166 166 set(handles.ordinate,'String',Field.Display.ListVarName)% fill the menu of y coordinate for 1D plots 167 167 checkseries=0; 168 if isfield(ParamIn,'SeriesInput') && ParamIn.SeriesInput 168 if isfield(ParamIn,'SeriesInput') && ParamIn.SeriesInput% case of call by series 169 169 set(handles.FieldOption,'value',1) 170 set(handles.FieldOption,'String',{'scalar'})% case of call by series, only scalar 170 if isfield(Field,'Conventions')&& strcmp(Field.Conventions,'uvmat/civdata') 171 set(handles.FieldOption,'String',{'pick variables';'civdata...'}) 172 else 173 set(handles.FieldOption,'String',{'pick variables'}) 174 end 171 175 checkseries=1; 172 176 set(handles.scalar,'Max',2) … … 403 407 ordinate_Callback(hObject, eventdata, handles) 404 408 405 case 'scalar'409 case {'scalar','pick variables'} 406 410 set(handles.Coordinates,'Visible','on') 407 411 set(handles.PanelOrdinate,'Visible','off') … … 954 958 case '1D plot' 955 959 956 case 'scalar'960 case {'scalar','pick variables'} 957 961 scalar_Callback(hObject, eventdata, handles) 958 962 case 'vectors' 959 963 end 960 964 961 % --- Executes on button press in CheckDimensionY.962 function CheckDimensionY_Callback(hObject, eventdata, handles)963 FieldList=get(handles.FieldOption,'String');964 FieldOption=FieldList{get(handles.FieldOption,'Value')};965 switch FieldOption966 case '1D plot'967 968 case 'scalar' 969 scalar_Callback(hObject, eventdata, handles)970 case 'vectors'971 end972 973 974 % --- Executes on button press in CheckDimensionZ.975 function CheckDimensionZ_Callback(hObject, eventdata, handles)976 FieldList=get(handles.FieldOption,'String');977 FieldOption=FieldList{get(handles.FieldOption,'Value')};978 switch FieldOption979 case '1D plot'980 981 case 'scalar'982 scalar_Callback(hObject, eventdata, handles)983 case 'vectors'984 end965 % % --- Executes on button press in CheckDimensionY. 966 % function CheckDimensionY_Callback(hObject, eventdata, handles) 967 % FieldList=get(handles.FieldOption,'String'); 968 % FieldOption=FieldList{get(handles.FieldOption,'Value')}; 969 % switch FieldOption 970 % case '1D plot' 971 % 972 % case {'scalar','pick variables'} 973 % scalar_Callback(hObject, eventdata, handles) 974 % case 'vectors' 975 % end 976 % 977 % 978 % % --- Executes on button press in CheckDimensionZ. 979 % function CheckDimensionZ_Callback(hObject, eventdata, handles) 980 % FieldList=get(handles.FieldOption,'String'); 981 % FieldOption=FieldList{get(handles.FieldOption,'Value')}; 982 % switch FieldOption 983 % case '1D plot' 984 % 985 % case 'scalar' 986 % scalar_Callback(hObject, eventdata, handles) 987 % case 'vectors' 988 % end 985 989 986 990 % --- Executes on selection change in TimeName. -
trunk/src/keyboard_callback.m
r726 r764 51 51 otherwise 52 52 if ischar(get(gco,'Tag')) 53 switch get(gco,'tag')% tag of the current edit box 54 case {'RootPath', 'SubDir','RootFile','FileExt','RootPath_1', 'SubDir_1','RootFile_1','FileExt_1'} 55 set(handleshaxes.InputFileREFRESH,'BackgroundColor',[1 0 1])%indicat that REFRESH must be activated (introduce the whole series) 56 case 'num_IndexIncrement'% no action 57 otherwise 58 if isfield(handleshaxes,'REFRESH') 59 set(handleshaxes.REFRESH,'BackgroundColor',[1 0 1])%indicat that run0 must be activated 60 elseif strcmp(get(gco,'Type'),'uicontrol') 61 set(gco,'BackgroundColor',[1 0 1])%indicate that the edition must be validated by carriage return 62 end 63 end 53 switch get(gco,'tag')% tag of the current edit box 54 case {'RootPath', 'SubDir','RootFile','FileExt','RootPath_1', 'SubDir_1','RootFile_1','FileExt_1'} 55 set(handleshaxes.InputFileREFRESH,'BackgroundColor',[1 0 1])%indicat that REFRESH must be activated (introduce the whole series) 56 case 'num_IndexIncrement'% no action 57 otherwise 58 if isfield(handleshaxes,'REFRESH') 59 set(handleshaxes.REFRESH,'BackgroundColor',[1 0 1])%indicat that run0 must be activated 60 if isfield(handleshaxes,'movie_pair')% stop movie pair in uvmat 61 set(handleshaxes.movie_pair,'value',0); 62 set(handleshaxes.movie_pair,'BusyAction','Cancel')%stop movie pair if button is 'off' 63 set(handleshaxes.i2,'String','')% the second i index display is suppressed 64 set(handleshaxes.j2,'String','')% the second j index display is suppressed 65 set(handleshaxes.Dt_txt,'String','')% the time interval indication is suppressed 66 end 67 elseif strcmp(get(gco,'Type'),'uicontrol') 68 set(gco,'BackgroundColor',[1 0 1])%indicate that the edition must be validated by carriage return 69 end 70 end 64 71 end 65 72 end -
trunk/src/series.m
r760 r764 582 582 errormsg=['input file ' fileinput ' does not exist']; 583 583 msgbox_uvmat('ERROR',errormsg) 584 set(handles.REFRESH,'BackgroundColor',[1 0 0])% set REFRESH button to red color (end of activation)584 set(handles.REFRESH,'BackgroundColor',[1 0 1])% set REFRESH button to magenta color (refresh still needed) 585 585 return 586 586 end … … 594 594 errormsg='no input file in the series'; 595 595 msgbox_uvmat('ERROR',errormsg) 596 set(handles.REFRESH,'BackgroundColor',[1 0 0])% set REFRESH button to redcolor (end of activation)596 set(handles.REFRESH,'BackgroundColor',[1 0 1])% set REFRESH button to magenta color (end of activation) 597 597 return 598 598 end 599 599 if strcmp(FileType,'txt') 600 600 edit(fileinput) 601 set(handles.REFRESH,'BackgroundColor',[1 0 0])% set REFRESH button to redcolor (end of activation)601 set(handles.REFRESH,'BackgroundColor',[1 0 1])% set REFRESH button to magenta color (end of activation) 602 602 return 603 603 elseif strcmp(FileType,'xml') 604 604 editxml(fileinput) 605 set(handles.REFRESH,'BackgroundColor',[1 0 0])% set REFRESH button to redcolor (end of activation)605 set(handles.REFRESH,'BackgroundColor',[1 0 1])% set REFRESH button to magenta color (end of activation) 606 606 return 607 607 elseif strcmp(FileType,'figure') 608 608 open(fileinput) 609 set(handles.REFRESH,'BackgroundColor',[1 0 0])% set REFRESH button to redcolor (end of activation)609 set(handles.REFRESH,'BackgroundColor',[1 0 1])% set REFRESH button to magenta color (end of activation) 610 610 return 611 611 end … … 624 624 625 625 626 627 626 %% fill the list of file series 628 627 InputTable=get(handles.InputTable,'Data'); … … 630 629 if strcmp(iview,'append') % display the input data as a new line in the table 631 630 iview=size(InputTable,1)+1;% the next line in InputTable becomes the current line 632 %InputTable(iview+1,:)={'','','','',''};633 631 InputTable(iview,:)=[{RootPath},{SubDir},{RootFile},{NomType},{FileExt}]; 634 632 elseif strcmp(iview,'one') % refresh the list of input file series 635 633 iview=1; %the first line in InputTable becomes the current line 636 634 InputTable={'','','','',''}; 637 %InputTable=[{'','','','',''};{'','','','',''}];638 635 InputTable(iview,:)=[{RootPath},{SubDir},{RootFile},{NomType},{FileExt}]; 639 636 set(handles.TimeTable,'Data',[{[]},{[]},{[]},{[]}]) … … 653 650 SeriesData.Time={}; 654 651 end 655 %nbview=size(InputTable,1)-1;% rmq: the last line is set blank to allow manual addition of a line656 652 nbview=size(InputTable,1); 657 653 set(handles.ListView,'String',mat2cell((1:nbview)',ones(nbview,1))) 658 654 set(handles.ListView,'Value',iview) 655 SeriesData.ListViewValue=iview; 656 SeriesData.ListViewMenu=mat2cell((1:nbview)',ones(nbview,1)); 659 657 set(handles.InputTable,'Data',InputTable) 660 658 … … 668 666 ref_i=floor((i1+i2)/2);% reference image number corresponding to the file 669 667 set(handles.num_ref_i,'String',num2str(ref_i)); 670 % set(handles.num_ref_i,'UserData',[i1 i2])%store the indices for future opening671 668 if isempty(j1) 672 669 j1=1; … … 981 978 MaxIndex_i=max(MaxIndex_i); 982 979 range_index=MaxIndex_i-MinIndex_i+1; 983 % scale_y=Position(4)/nbview;984 % scale_x=Position(3)/range_index;985 %x=(0.5:range_index-0.5)*Position(3)/range_index;% set of abscissa representing the whole i index range986 % y=(0.5:nbview-0.5)*Position(4)/nbview;987 980 range_y=max(1,floor(Position(4)/nbview)); 988 981 npx=floor(Position(3)); … … 1010 1003 set(handles.Pairs,'Visible','on') 1011 1004 set(handles.PairString,'Visible','on') 1005 set(handles.SetPairs,'Visible','on') 1012 1006 else 1013 1007 set(handles.Pairs,'Visible','off') 1014 1008 set(handles.PairString,'Visible','off') 1009 set(handles.SetPairs,'Visible','off') 1015 1010 end 1016 1011 … … 1025 1020 switch FileType 1026 1021 case {'civx','civdata'} 1027 [FieldList,ColorList]=set_field_list('U','V','C');1028 set(handles.FieldName,'String',[ {'image'};FieldList;{'get_field...'}]);%standard menu for civx data1029 set(handles.FieldName,'Value', 2) % set menu to 'velocity1022 FieldList=set_field_list('U','V','C'); 1023 set(handles.FieldName,'String',[FieldList;{'get_field...'}]);%standard menu for civx data 1024 set(handles.FieldName,'Value',1) % set menu to 'velocity 1030 1025 set(handles.Coord_x,'Value',1); 1031 1026 set(handles.Coord_x,'String',{'X'}); … … 1233 1228 % check_burst=0; 1234 1229 if isempty(j2_series)% no j pair 1230 ModeValue=1; 1235 1231 if isempty(i2_series) 1236 set(handles.mode,'Value',1)1237 1232 set(handles.mode,'String',{''})% no pair menu to display 1238 1233 else 1239 1234 set(handles.mode,'Value',1) 1240 set(handles.mode,'String',{'series(Di)'})% pair menu with only option Di1235 ModeMenu={'series(Di)'}; % pair menu with only option Di 1241 1236 end 1242 1237 else %existence of j pairs … … 1249 1244 MinIndex_j=min(find(i_max))-1;% min ref index i 1250 1245 if MaxIndex_j==MinIndex_j 1251 set(handles.mode,'Value',1); 1252 set(handles.mode,'String',{'bursts'}) 1253 % check_burst=1; 1246 ModeValue=1; 1247 ModeMenu={'bursts'}; 1254 1248 elseif MaxIndex_i==MinIndex_i 1255 set(handles.mode,'Value',1);1256 set(handles.mode,'String',{'series(Dj)'})1249 ModeValue=1; 1250 ModeMenu={'series(Dj)'}; 1257 1251 else 1258 set(handles.mode,'String',{'bursts';'series(Dj)'})1252 ModeMenu={'bursts';'series(Dj)'}; 1259 1253 if (MaxIndex_j-MinIndex_j)>10 1260 set(handles.mode,'Value',2);%set mode to series(Dj) if more than 10 j values1254 ModeValue=2;%set mode to series(Dj) if more than 10 j values 1261 1255 else 1262 set(handles.mode,'Value',1); 1263 % check_burst=1; 1264 end 1265 end 1266 end 1256 ModeValue=1; 1257 end 1258 end 1259 end 1260 1261 set(handles.mode,'String',ModeMenu) 1262 set(handles.mode,'Value',ModeValue) 1263 SeriesData=get(handles.series,'UserData'); 1264 SeriesData.ModeMenu=ModeMenu; 1265 SeriesData.ModeValue=ModeValue; 1266 set(handles.series,'UserData',SeriesData) 1267 1267 fill_ListPair(handles,i1_series,i2_series,j1_series,j2_series,time) 1268 1268 ListPairs_Callback([],[],handles) … … 1369 1369 1370 1370 %% display list of pairstring 1371 SeriesData=get(handles.series,'UserData'); 1371 1372 displ_pair_list=get(handles.ListPairs,'String'); 1372 1373 NewVal=[]; … … 1377 1378 if ~isempty(NewVal) 1378 1379 set(handles.ListPairs,'Value',NewVal) 1380 SeriesData.ListPairsValue=NewVal; 1379 1381 else 1380 1382 set(handles.ListPairs,'Value',1) 1383 SeriesData.ListPairsValue=1; 1381 1384 end 1382 1385 set(handles.ListPairs,'String',displ_pair) 1386 SeriesData.ListPairsMenu=displ_pair; 1387 set(handles.series,'UserData',SeriesData); 1383 1388 1384 1389 %------------------------------------- … … 1422 1427 Param=read_GUI_series(handles);%displayed parameters 1423 1428 SeriesData=get(handles.series,'UserData');%hidden parameters 1429 1430 1431 1432 %% select the Action mode, 'local', 'background' or 'cluster' (if available) 1433 RunMode='local';%default (needed for first opening of the GUI series) 1434 if isfield(Param.Action,'RunMode') 1435 RunMode=Param.Action.RunMode; 1436 end 1437 ActionExt='.m';%default 1438 if isfield(Param.Action,'ActionExt') 1439 ActionExt=Param.Action.ActionExt;% '.m' or '.sh' (compiled) 1440 end 1441 ActionName=Param.Action.ActionName; 1442 ActionPath=Param.Action.ActionPath; 1443 path_series=fileparts(which('series')); 1444 1445 %% create the Action fct handle if RunMode option = 'local' 1446 if strcmp(RunMode,'local') 1447 if ~isequal(ActionPath,path_series) 1448 eval(['spath=which(''' ActionName ''');']) %spath = current path of the selected function ACTION 1449 if ~exist(ActionPath,'dir') 1450 msgbox_uvmat('ERROR',['The prescribed function path ' ActionPath ' does not exist']); 1451 return 1452 end 1453 if ~isequal(spath,ActionPath) 1454 addpath(ActionPath)% add the prescribed path if not the current one 1455 end 1456 end 1457 eval(['h_fun=@' ActionName ';'])%create a function handle for ACTION 1458 if ~isequal(ActionPath,path_series) 1459 rmpath(ActionPath)% add the prescribed path if not the current one 1460 end 1461 end 1462 1463 %% Get RunTime code from the file PARAM.xml (needed to run compiled functions) 1464 errormsg='';%default error message 1465 xmlfile=fullfile(path_series,'PARAM.xml'); 1466 test_batch=0;%default: ,no batch mode available 1467 if ~exist(xmlfile,'file') 1468 [success,message]=copyfile(fullfile(path_series,'PARAM.xml.default'),xmlfile); 1469 end 1470 RunTime=''; 1471 if strcmp(ActionExt,'.sh') 1472 if exist(xmlfile,'file') 1473 s=xml2struct(xmlfile); 1474 if strcmp(RunMode,'cluster_oar') && isfield(s,'BatchParam') 1475 if isfield(s.BatchParam,'RunTime') 1476 RunTime=s.BatchParam.RunTime; 1477 end 1478 if isfield(s.BatchParam,'NbCore') 1479 NbCore=s.BatchParam.NbCore; 1480 end 1481 elseif (strcmp(RunMode,'background')||strcmp(RunMode,'local')) && isfield(s,'RunParam') 1482 if isfield(s.RunParam,'RunTime') 1483 RunTime=s.RunParam.RunTime; 1484 end 1485 if isfield(s.RunParam,'NbCore') 1486 NbCore=s.RunParam.NbCore; 1487 end 1488 end 1489 end 1490 if isempty(RunTime) && strcmp(RunMode,'cluster_oar') 1491 msgbox_uvmat('ERROR','RunTime name not found in PARAM.xml, compiled version .sh cannot run on cluster') 1492 return 1493 end 1494 end 1495 1496 %% If a compiled version has been selected (ext .sh) check weather it needs to be recompiled 1497 % ActionExtList=get(handles.ActionExt,'String'); 1498 % ActionExt=ActionExtList{get(handles.ActionExt,'Value')}; 1499 % ActionList=get(handles.ActionName,'String'); 1500 % ActionName=ActionList{get(handles.ActionName,'Value')}; 1501 % TransformPath=''; 1502 % if ~isempty(get(handles.ActionExt,'UserData')) 1503 % TransformPath=get(handles.ActionExt,'UserData'); 1504 % end 1505 if strcmp(ActionExt,'.sh') 1506 TransformPath=''; 1507 if ~isempty(get(handles.ActionExt,'UserData')) 1508 TransformPath=get(handles.ActionExt,'UserData'); 1509 end 1510 set(handles.series,'Pointer','watch') % set the mouse pointer to 'watch' 1511 set(handles.ActionExt,'BackgroundColor',[1 1 0]) 1512 ActionFullName=fullfile(get(handles.ActionPath,'String'),[ActionName '.sh']); 1513 if ~exist(ActionFullName,'file') 1514 answer=msgbox_uvmat('INPUT_Y-N','compiled version has not been created: compile now?'); 1515 if strcmp(answer,'Yes') 1516 set(handles.ActionExt,'BackgroundColor',[1 1 0]) 1517 path_uvmat=fileparts(which('series')); 1518 currentdir=pwd; 1519 cd(get(handles.ActionPath,'String'))% go to the directory of Action 1520 % addpath(get(handles.TransformPath,'String')) 1521 addpath(path_uvmat)% add the path to uvmat to run the fct 'compile' 1522 % addpath(fullfile(path_uvmat,'transform_field'))% add the path to uvmat to run the fct 'compile' 1523 compile(ActionName,TransformPath) 1524 cd(currentdir) 1525 end 1526 else 1527 sh_file_info=dir(fullfile(get(handles.ActionPath,'String'),[ActionName '.sh'])); 1528 m_file_info=dir(fullfile(get(handles.ActionPath,'String'),[ActionName '.m'])); 1529 if isfield(m_file_info,'datenum') && m_file_info.datenum>sh_file_info.datenum 1530 set(handles.ActionExt,'BackgroundColor',[1 1 0]) 1531 drawnow 1532 answer=msgbox_uvmat('INPUT_Y-N',[ActionName '.sh needs to be updated: recompile now?']); 1533 if strcmp(answer,'Yes') 1534 path_uvmat=fileparts(which('series')); 1535 currentdir=pwd; 1536 cd(get(handles.ActionPath,'String'))% go to the directory of Action 1537 % addpath(get(handles.TransformPath,'String')) 1538 addpath(path_uvmat)% add the path to uvmat to run the fct 'compile' 1539 addpath(fullfile(path_uvmat,'transform_field'))% add the path to uvmat to run the fct 'compile' 1540 compile(ActionName,TransformPath) 1541 cd(currentdir) 1542 end 1543 end 1544 end 1545 set(handles.ActionExt,'BackgroundColor',[1 1 1]) 1546 set(handles.series,'Pointer','arrow') % set the mouse pointer to 'watch 1547 end 1548 1549 %% set nbre of cluster cores and processes 1550 switch RunMode 1551 case {'local','background'} 1552 NbCore=1;% no need to split the calculation 1553 case 'cluster_oar' 1554 if strcmp(Param.Action.ActionExt,'.m')% case of Matlab function (uncompiled) 1555 NbCore=1;% one core used only (limitation of Matlab licences) 1556 msgbox_uvmat('WARNING','Number of cores =1: select the compiled version civ_matlab.sh for multi-core processing'); 1557 extra_oar=''; 1558 else 1559 answer=inputdlg({'Number of cores (max 36)','extra oar options'},'oarsub parameter',1,{'12',''}); 1560 NbCore=str2double(answer{1}); 1561 extra_oar=answer{2}; 1562 end 1563 end 1564 if ~isfield(Param.IndexRange,'NbSlice') 1565 Param.IndexRange.NbSlice=[]; 1566 end 1567 if isempty(Param.IndexRange.NbSlice) 1568 NbProcess=NbCore;% choose one process per core 1569 else 1570 NbProcess=Param.IndexRange.NbSlice;% the nbre of run processes is equal to the number of slices 1571 NbCore=min(NbCore,NbProcess);% at least one process per core 1572 end 1424 1573 1425 1574 %% create the output data directory if needed … … 1478 1627 end 1479 1628 end 1480 end1481 1482 %% select the Action mode, 'local', 'background' or 'cluster' (if available)1483 RunMode='local';%default (needed for first opening of the GUI series)1484 if isfield(Param.Action,'RunMode')1485 RunMode=Param.Action.RunMode;1486 end1487 ActionExt='.m';%default1488 if isfield(Param.Action,'ActionExt')1489 ActionExt=Param.Action.ActionExt;% '.m' or '.sh' (compiled)1490 end1491 ActionName=Param.Action.ActionName;1492 ActionPath=Param.Action.ActionPath;1493 path_series=fileparts(which('series'));1494 1495 %% create the Action fct handle if RunMode option = 'local'1496 if strcmp(RunMode,'local')1497 if ~isequal(ActionPath,path_series)1498 eval(['spath=which(''' ActionName ''');']) %spath = current path of the selected function ACTION1499 if ~exist(ActionPath,'dir')1500 msgbox_uvmat('ERROR',['The prescribed function path ' ActionPath ' does not exist']);1501 return1502 end1503 if ~isequal(spath,ActionPath)1504 addpath(ActionPath)% add the prescribed path if not the current one1505 end1506 end1507 eval(['h_fun=@' ActionName ';'])%create a function handle for ACTION1508 if ~isequal(ActionPath,path_series)1509 rmpath(ActionPath)% add the prescribed path if not the current one1510 end1511 end1512 1513 %% Get RunTime code from the file PARAM.xml (needed to run compiled functions)1514 errormsg='';%default error message1515 xmlfile=fullfile(path_series,'PARAM.xml');1516 test_batch=0;%default: ,no batch mode available1517 if ~exist(xmlfile,'file')1518 [success,message]=copyfile(fullfile(path_series,'PARAM.xml.default'),xmlfile);1519 end1520 RunTime='';1521 if strcmp(ActionExt,'.sh')1522 if exist(xmlfile,'file')1523 s=xml2struct(xmlfile);1524 if strcmp(RunMode,'cluster_oar') && isfield(s,'BatchParam')1525 if isfield(s.BatchParam,'RunTime')1526 RunTime=s.BatchParam.RunTime;1527 end1528 if isfield(s.BatchParam,'NbCore')1529 NbCore=s.BatchParam.NbCore;1530 end1531 elseif (strcmp(RunMode,'background')||strcmp(RunMode,'local')) && isfield(s,'RunParam')1532 if isfield(s.RunParam,'RunTime')1533 RunTime=s.RunParam.RunTime;1534 end1535 if isfield(s.RunParam,'NbCore')1536 NbCore=s.RunParam.NbCore;1537 end1538 end1539 end1540 if isempty(RunTime) && strcmp(RunMode,'cluster_oar')1541 msgbox_uvmat('ERROR','RunTime name not found in PARAM.xml, compiled version .sh cannot run on cluster')1542 return1543 end1544 end1545 1546 %% set nbre of cluster cores and processes1547 switch RunMode1548 case {'local','background'}1549 NbCore=1;% no need to split the calculation1550 case 'cluster_oar'1551 if strcmp(Param.Action.ActionExt,'.m')% case of Matlab function (uncompiled)1552 NbCore=1;% one core used only (limitation of Matlab licences)1553 msgbox_uvmat('WARNING','Number of cores =1: select the compiled version civ_matlab.sh for multi-core processing');1554 extra_oar='';1555 else1556 answer=inputdlg({'Number of cores (max 36)','extra oar options'},'oarsub parameter',1,{'12',''});1557 NbCore=str2double(answer{1});1558 extra_oar=answer{2};1559 end1560 end1561 if ~isfield(Param.IndexRange,'NbSlice')1562 Param.IndexRange.NbSlice=[];1563 end1564 if isempty(Param.IndexRange.NbSlice)1565 NbProcess=NbCore;% choose one process per core1566 else1567 NbProcess=Param.IndexRange.NbSlice;% the nbre of run processes is equal to the number of slices1568 NbCore=min(NbCore,NbProcess);% at least one process per core1569 1629 end 1570 1630 … … 2245 2305 Param=read_GUI(handles.series); 2246 2306 Param.InputTable=Param.InputTable(1,:); 2247 2307 % check the existence of the first file in the series 2248 2308 first_j=[]; 2249 2309 if isfield(Param.IndexRange,'first_j'); first_j=Param.IndexRange.first_j; end … … 2255 2315 FirstFileName=fullfile_uvmat(Param.InputTable{1,1},Param.InputTable{1,2},Param.InputTable{1,3},... 2256 2316 Param.InputTable{1,5},Param.InputTable{1,4},i1,i2,j1,j2); 2257 % filecell=get_file_series(Param);2258 %2259 2317 if exist(FirstFileName,'file') 2260 2318 ParamIn.SeriesInput=1; … … 2266 2324 VName=GetFieldData.PanelVectors.vector_y; 2267 2325 YName={GetFieldData.Coordinates.Coord_y}; 2268 CName=GetFieldData.PanelVectors.vec_color;2269 2326 FieldList={['vec(' UName ',' VName ')'];... 2270 2327 ['norm(' UName ',' VName ')'];... 2271 2328 UName;VName}; 2272 VecColorList={['norm(' UName ',' VName ')'];... 2273 UName;VName}; 2274 if ~isempty(CName) 2275 VecColorList=[{CName};VecColorList]; 2276 end 2277 case 'scalar' 2329 case {'scalar','pick variables'} 2278 2330 FieldList=GetFieldData.PanelScalar.scalar; 2279 2331 YName={GetFieldData.Coordinates.Coord_y}; 2280 2332 if ischar(FieldList) 2281 FieldList={FieldList};2333 FieldList={FieldList}; 2282 2334 end 2283 2335 case '1D plot' 2284 2336 YName=GetFieldData.PanelOrdinate.ordinate; 2285 % case 'civdata...'%reinitiate input, return to automatic civ data reading 2286 % display_file_name(handles,FileName,1) 2337 case 'civdata...' 2338 FieldList=set_field_list('U','V','C'); 2339 set(handles.FieldName,'Value',2) % set menu to 'velocity 2340 XName='X'; 2341 YName='y'; 2287 2342 end 2288 2343 if ~strcmp(GetFieldData.FieldOption,'civdata...') … … 2307 2362 ParamIn.TimeDimName=GetFieldData.Time.TimeName; 2308 2363 end 2309 set(handles.Coord_x,'String',{XName})2310 set(handles.Coord_y,'String',YName)2311 set(handles.FieldName,'Value',1)2312 set(handles.FieldName,'String',[FieldList; {'get_field...'}]);2313 end2364 end 2365 set(handles.Coord_x,'String',{XName}) 2366 set(handles.Coord_y,'String',YName) 2367 set(handles.FieldName,'Value',1) 2368 set(handles.FieldName,'String',[FieldList; {'get_field...'}]); 2314 2369 end 2315 2370 end … … 2321 2376 field_str=get(handles.FieldName_1,'String'); 2322 2377 field_index=get(handles.FieldName_1,'Value'); 2323 field=field_str{field_index}; 2324 if isequal(field,'get_field...') 2325 hget_field=findobj(allchild(0),'name','get_field_1'); 2326 if ~isempty(hget_field) 2327 delete(hget_field) 2328 end 2329 SeriesData=get(handles.series,'UserData'); 2330 filename=SeriesData.CurrentInputFile_1; 2331 if exist(filename,'file') 2332 hget_field=get_field(filename); 2333 set(hget_field,'name','get_field_1') 2334 end 2335 % elseif isequal(field,'more...') 2336 % str=calc_field; 2337 % [ind_answer,v] = listdlg('PromptString','Select a file:',... 2338 % 'SelectionMode','single',... 2339 % 'ListString',str); 2340 % % edit the choice in the fields and actionname menu 2341 % scalar=cell2mat(str(ind_answer)); 2342 % update_menu(handles.FieldName_1,scalar) 2378 field=field_str{field_index(1)}; 2379 if isequal(field,'get_field...') 2380 hget_field=findobj(allchild(0),'name','get_field'); 2381 if ~isempty(hget_field) 2382 delete(hget_field)%delete opened versions of get_field 2383 end 2384 Param=read_GUI(handles.series); 2385 Param.InputTable=Param.InputTable(1,:); 2386 % check the existence of the first file in the series 2387 first_j=[]; 2388 if isfield(Param.IndexRange,'first_j'); first_j=Param.IndexRange.first_j; end 2389 if isfield(Param.IndexRange,'last_j'); last_j=Param.IndexRange.last_j; end 2390 PairString=''; 2391 if isfield(Param.IndexRange,'PairString'); PairString=Param.IndexRange.PairString; end 2392 [i1,i2,j1,j2] = get_file_index(Param.IndexRange.first_i,first_j,PairString); 2393 FirstFileName=fullfile_uvmat(Param.InputTable{1,1},Param.InputTable{1,2},Param.InputTable{1,3},... 2394 Param.InputTable{1,5},Param.InputTable{1,4},i1,i2,j1,j2); 2395 if exist(FirstFileName,'file') 2396 ParamIn.SeriesInput=1; 2397 GetFieldData=get_field(FirstFileName,ParamIn); 2398 FieldList={}; 2399 switch GetFieldData.FieldOption 2400 case 'vectors' 2401 UName=GetFieldData.PanelVectors.vector_x; 2402 VName=GetFieldData.PanelVectors.vector_y; 2403 FieldList={['vec(' UName ',' VName ')'];... 2404 ['norm(' UName ',' VName ')'];... 2405 UName;VName}; 2406 case {'scalar','pick variables'} 2407 FieldList=GetFieldData.PanelScalar.scalar; 2408 if ischar(FieldList) 2409 FieldList={FieldList}; 2410 end 2411 case '1D plot' 2412 2413 case 'civdata...' 2414 FieldList=set_field_list('U','V','C'); 2415 set(handles.FieldName,'Value',2) % set menu to 'velocity 2416 end 2417 if ~strcmp(GetFieldData.FieldOption,'civdata...') 2418 TimeNameStr=GetFieldData.Time.SwitchVarIndexTime; 2419 switch TimeNameStr 2420 case 'file index' 2421 set(handles.TimeName,'String',''); 2422 case 'attribute' 2423 set(handles.TimeName,'String',['att:' GetFieldData.Time.TimeName]); 2424 case 'variable' 2425 set(handles.TimeName,'String',['var:' GetFieldData.Time.TimeName]) 2426 set(handles.NomType,'String','*') 2427 set(handles.RootFile,'String',[get(handles.RootFile,'String') get(handles.FileIndex,'String')])% A VERIFIER !!!!!! 2428 set(handles.FileIndex,'String','') 2429 ParamIn.TimeVarName=GetFieldData.Time.TimeName; 2430 case 'matrix_index' 2431 set(handles.TimeName,'String',['dim:' GetFieldData.Time.TimeName]); 2432 set(handles.NomType,'String','*') 2433 set(handles.RootFile,'String',[get(handles.RootFile,'String') get(handles.FileIndex,'String')]) 2434 set(handles.FileIndex,'String','') 2435 ParamIn.TimeDimName=GetFieldData.Time.TimeName; 2436 end 2437 end 2438 set(handles.FieldName_1,'Value',1) 2439 set(handles.FieldName_1,'String',[FieldList; {'get_field...'}]); 2440 end 2343 2441 end 2344 2442 … … 2927 3025 ActionList=get(handles.ActionName,'String'); 2928 3026 ActionName=ActionList{get(handles.ActionName,'Value')}; 2929 TransformPath=''; 2930 if ~isempty(get(handles.ActionExt,'UserData')) 2931 TransformPath=get(handles.ActionExt,'UserData'); 2932 end 2933 if strcmp(ActionExt,'.sh') 2934 set(handles.series,'Pointer','watch') % set the mouse pointer to 'watch' 2935 set(handles.ActionExt,'BackgroundColor',[1 1 0]) 2936 ActionFullName=fullfile(get(handles.ActionPath,'String'),[ActionName '.sh']); 2937 if ~exist(ActionFullName,'file') 2938 answer=msgbox_uvmat('INPUT_Y-N','compiled version has not been created: compile now?'); 2939 if strcmp(answer,'Yes') 2940 set(handles.ActionExt,'BackgroundColor',[1 1 0]) 2941 path_uvmat=fileparts(which('series')); 2942 currentdir=pwd; 2943 cd(get(handles.ActionPath,'String'))% go to the directory of Action 2944 % addpath(get(handles.TransformPath,'String')) 2945 addpath(path_uvmat)% add the path to uvmat to run the fct 'compile' 2946 % addpath(fullfile(path_uvmat,'transform_field'))% add the path to uvmat to run the fct 'compile' 2947 compile(ActionName,TransformPath) 2948 cd(currentdir) 2949 end 2950 else 2951 sh_file_info=dir(fullfile(get(handles.ActionPath,'String'),[ActionName '.sh'])); 2952 m_file_info=dir(fullfile(get(handles.ActionPath,'String'),[ActionName '.m'])); 2953 if isfield(m_file_info,'datenum') && m_file_info.datenum>sh_file_info.datenum 2954 set(handles.ActionExt,'BackgroundColor',[1 1 0]) 2955 drawnow 2956 answer=msgbox_uvmat('INPUT_Y-N',[ActionName '.sh needs to be updated: recompile now?']); 2957 if strcmp(answer,'Yes') 2958 path_uvmat=fileparts(which('series')); 2959 currentdir=pwd; 2960 cd(get(handles.ActionPath,'String'))% go to the directory of Action 2961 % addpath(get(handles.TransformPath,'String')) 2962 addpath(path_uvmat)% add the path to uvmat to run the fct 'compile' 2963 addpath(fullfile(path_uvmat,'transform_field'))% add the path to uvmat to run the fct 'compile' 2964 compile(ActionName,TransformPath) 2965 cd(currentdir) 2966 end 2967 end 2968 end 2969 set(handles.ActionExt,'BackgroundColor',[1 1 1]) 2970 set(handles.series,'Pointer','arrow') % set the mouse pointer to 'watch 2971 end 2972 2973 3027 % TransformPath=''; 3028 % if ~isempty(get(handles.ActionExt,'UserData')) 3029 % TransformPath=get(handles.ActionExt,'UserData'); 3030 % end 3031 % if strcmp(ActionExt,'.sh') 3032 % set(handles.series,'Pointer','watch') % set the mouse pointer to 'watch' 3033 % set(handles.ActionExt,'BackgroundColor',[1 1 0]) 3034 % ActionFullName=fullfile(get(handles.ActionPath,'String'),[ActionName '.sh']); 3035 % if ~exist(ActionFullName,'file') 3036 % answer=msgbox_uvmat('INPUT_Y-N','compiled version has not been created: compile now?'); 3037 % if strcmp(answer,'Yes') 3038 % set(handles.ActionExt,'BackgroundColor',[1 1 0]) 3039 % path_uvmat=fileparts(which('series')); 3040 % currentdir=pwd; 3041 % cd(get(handles.ActionPath,'String'))% go to the directory of Action 3042 % % addpath(get(handles.TransformPath,'String')) 3043 % addpath(path_uvmat)% add the path to uvmat to run the fct 'compile' 3044 % % addpath(fullfile(path_uvmat,'transform_field'))% add the path to uvmat to run the fct 'compile' 3045 % compile(ActionName,TransformPath) 3046 % cd(currentdir) 3047 % end 3048 % else 3049 % sh_file_info=dir(fullfile(get(handles.ActionPath,'String'),[ActionName '.sh'])); 3050 % m_file_info=dir(fullfile(get(handles.ActionPath,'String'),[ActionName '.m'])); 3051 % if isfield(m_file_info,'datenum') && m_file_info.datenum>sh_file_info.datenum 3052 % set(handles.ActionExt,'BackgroundColor',[1 1 0]) 3053 % drawnow 3054 % answer=msgbox_uvmat('INPUT_Y-N',[ActionName '.sh needs to be updated: recompile now?']); 3055 % if strcmp(answer,'Yes') 3056 % path_uvmat=fileparts(which('series')); 3057 % currentdir=pwd; 3058 % cd(get(handles.ActionPath,'String'))% go to the directory of Action 3059 % % addpath(get(handles.TransformPath,'String')) 3060 % addpath(path_uvmat)% add the path to uvmat to run the fct 'compile' 3061 % addpath(fullfile(path_uvmat,'transform_field'))% add the path to uvmat to run the fct 'compile' 3062 % compile(ActionName,TransformPath) 3063 % cd(currentdir) 3064 % end 3065 % end 3066 % end 3067 % set(handles.ActionExt,'BackgroundColor',[1 1 1]) 3068 % set(handles.series,'Pointer','arrow') % set the mouse pointer to 'watch 3069 % end 2974 3070 2975 3071 … … 3022 3118 function series_WindowButtonMotionFcn(hObject, eventdata, handles) 3023 3119 set(hObject,'Pointer','arrow'); 3120 3121 3122 % --- Executes on button press in SetPairs. 3123 function SetPairs_Callback(hObject, eventdata, handles) 3124 3125 %% create the GUI set_pairs 3126 set(0,'Unit','points') 3127 ScreenSize=get(0,'ScreenSize');% get the size of the screen, to put the fig on the upper right 3128 Width=300;% fig width in points (1/72 inch) 3129 Height=min(0.8*ScreenSize(4),300); 3130 Left=ScreenSize(3)- Width-40; %right edge close to the right, with margin=40 3131 Bottom=ScreenSize(4)-Height-40; %put fig at top right 3132 hfig=findobj(allchild(0),'Tag','set_slice'); 3133 if ~isempty(hfig),delete(hfig), end; %delete existing version of the GUI 3134 hfig=figure('name','set_pairs','tag','set_pairs','MenuBar','none','NumberTitle','off','Unit','points','Position',[Left,Bottom,Width,Height]); 3135 BackgroundColor=get(hfig,'Color'); 3136 hh=0.14; % box height (relative) 3137 ii=0.01; % gap between uicontrols 3138 3139 ww=0.9; % box width (relative) 3140 SeriesData=get(handles.series,'UserData'); 3141 % first raw of the GUI 3142 uicontrol('Style','text','Units','normalized', 'Position', [0.02 0.9 0.5 0.1],'BackgroundColor',BackgroundColor,... 3143 'String','row to edit #','FontUnits','points','FontSize',12,'FontWeight','bold','ForegroundColor','blue','HorizontalAlignment','right');%title 3144 uicontrol('Style','popupmenu','Units','normalized', 'Position', [0.54 0.8 0.3 0.2],'tag','ListView','BackgroundColor',[1 1 1],... 3145 'String',SeriesData.ListViewMenu,'Value',SeriesData.ListViewValue,'FontUnits','points','FontSize',12,'FontWeight','bold','TooltipString','''ListView'':choice of the file series w for pair display'); 3146 % second raw of the GUI 3147 uicontrol('Style','text','Units','normalized', 'Position', [0.02 0.8 0.7 0.1],'BackgroundColor',BackgroundColor,... 3148 'String','mode of index pairing:','FontUnits','points','FontSize',12,'FontWeight','bold','ForegroundColor','blue','HorizontalAlignment','left');%title 3149 uicontrol('Style','popupmenu','Units','normalized', 'Position', [0.02 0.58 ww 0.2],'tag','Mode','BackgroundColor',[1 1 1],'Callback',@(hObject,eventdata)ModeMenu_Callback(hObject,eventdata),... 3150 'String',SeriesData.ModeMenu,'Value',SeriesData.ModeValue,'FontUnits','points','FontSize',12,'FontWeight','bold','TooltipString','''Mode'': choice of the image pair mode'); 3151 % third raw 3152 uicontrol('Style','text','Units','normalized', 'Position', [0.02 0.6 0.7 0.1],'BackgroundColor',BackgroundColor,... 3153 'String','pair choice:','FontUnits','points','FontSize',12,'FontWeight','bold','ForegroundColor','blue','HorizontalAlignment','left');%title 3154 uicontrol('Style','listbox','Units','normalized', 'Position', [0.02 0.16 ww 0.4],'tag','ListPairs','BackgroundColor',[1 1 1],'Callback',@(hObject,eventdata)ListPairsMenu_Callback(hObject,eventdata),... 3155 'String',SeriesData.ListPairsMenu,'Value',SeriesData.ListPairsValue,'FontUnits','points','FontSize',12,'FontWeight','bold','TooltipString','''ListPairs'': menu for selecting the image pair'); 3156 % last raw of the GUI: pushbuttons 3157 wwp=(1-4*ii)/3; %width of the push buttons 3158 uicontrol('Style','pushbutton','Units','normalized', 'Position', [ii ii wwp hh],'BackgroundColor',[0 1 0],'String','OK','Callback',@(hObject,eventdata)OK_Callback(hObject,eventdata),... 3159 'FontWeight','bold','FontUnits','points','FontSize',12,'TooltipString','''OK'': apply the output to the current field series in uvmat'); 3160 drawnow 3161 3162 function ModeMenu_Callback(hObject,eventdata) 3163 hseries=findobj(allchild(0),'tag','series'); 3164 hhseries=guidata(hseries); 3165 SeriesData=get(hseries,'UserData'); 3166 hListView=findobj(get(hObject,'parent'),'Tag','ListView'); 3167 iview=get(hListView,'Value'); 3168 hMode=findobj(get(hObject,'parent'),'Tag','Mode'); 3169 mode_list=get(hMode,'String'); 3170 mode=mode_list{get(hMode,'Value')}; 3171 if isequal(mode,'bursts') 3172 enable_i(hhseries,'On') 3173 enable_j(hhseries,'Off') %do not display j index scanning in burst mode (j is fixed by the burst choice) 3174 else 3175 enable_i(hhseries,'On') 3176 enable_j(hhseries,'Off') 3177 end 3178 fill_ListPair(hhseries,SeriesData.i1_series{iview},SeriesData.i2_series{iview},... 3179 SeriesData.j1_series{iview},SeriesData.j2_series{iview},SeriesData.Time{iview}) 3180 ListPairs_Callback([],[],hhseries) 3181 3182 %------------------------------------------------------------- 3183 % --- Executes on selection in ListPairs. 3184 function ListPairsMenu_Callback(hObject,eventdata) 3185 %------------------------------------------------------------ 3186 list_pair=get(hObject,'String');%get the menu of image pairs 3187 if isempty(list_pair) 3188 string=''; 3189 else 3190 string=list_pair{get(hObject,'Value')}; 3191 string=regexprep(string,',.*','');%removes time indication (after ',') 3192 end 3193 hseries=findobj(allchild(0),'tag','series'); 3194 hPairString=findobj(hseries,'tag','PairString'); 3195 PairString=get(hPairString,'Data'); 3196 hListView=findobj(get(hObject,'parent'),'Tag','ListView'); 3197 iview=get(hListView,'Value'); 3198 PairString{iview,1}=string; 3199 % report the selected pair string to the table PairString 3200 set(hPairString,'Data',PairString) 3201 3202 %------------------------------------------------------------- 3203 % --- Executes on selection in ListPairs. 3204 function OK_Callback(hObject,eventdata) 3205 %------------------------------------------------------------ 3206 delete(get(hObject,'parent')) 3207 -
trunk/src/uvmat.m
r760 r764 610 610 %------------------------------------------------------------------------ 611 611 [tild,tild,tild,i1,i2,j1,j2]=fileparts_uvmat(get(handles.FileIndex,'String')); 612 set(handles.i1,'String',num2str(i1)); 612 set(handles.i1,'String',num2str(i1));%update the counters 613 613 set(handles.i2,'String',num2str(i2)); 614 614 set(handles.j1,'String',num2str(j1)); … … 626 626 FileIndex=fullfile_uvmat('','','','',get(handles.NomType,'String'),i1,i2,j1,j2); 627 627 set(handles.FileIndex,'String',FileIndex) 628 % inputfilerefresh the current settings and inputfilerefresh the field view628 % refresh the current settings and refresh the field view 629 629 RootPath_Callback(hObject,eventdata,handles) 630 630 … … 1260 1260 case 1 1261 1261 indices=fullfile_uvmat('','','','',NomType,stra2num(get(handles.i1,'String')),i2,j1,j2); 1262 set(handles.i1,'BackgroundColor',[0.7 0.7 0.7])% mark the edit box in grey, then RUN0 will mark it in white for confirmation1262 % set(handles.i1,'BackgroundColor',[0.7 0.7 0.7])% mark the edit box in grey, then RUN0 will mark it in white for confirmation 1263 1263 case 2 1264 1264 indices=fullfile_uvmat('','','','',NomType,i1,stra2num(get(handles.i2,'String')),j1,j2); 1265 set(handles.i2,'BackgroundColor',[0.7 0.7 0.7])% mark the edit box in grey, then RUN0 will mark it in white for confirmation1265 % set(handles.i2,'BackgroundColor',[0.7 0.7 0.7])% mark the edit box in grey, then RUN0 will mark it in white for confirmation 1266 1266 case 3 1267 1267 indices=fullfile_uvmat('','','','',NomType,i1,i2,stra2num(get(handles.j1,'String')),j2); 1268 set(handles.j1,'BackgroundColor',[0.7 0.7 0.7])% mark the edit box in grey, then RUN0 will mark it in white for confirmation1268 % set(handles.j1,'BackgroundColor',[0.7 0.7 0.7])% mark the edit box in grey, then RUN0 will mark it in white for confirmation 1269 1269 case 4 1270 1270 indices=fullfile_uvmat('','','','',NomType,i1,i2,j1,stra2num(get(handles.j2,'String'))); 1271 set(handles.j2,'BackgroundColor',[0.7 0.7 0.7])% mark the edit box in grey, then RUN0 will mark it in white for confirmation1271 % set(handles.j2,'BackgroundColor',[0.7 0.7 0.7])% mark the edit box in grey, then RUN0 will mark it in white for confirmation 1272 1272 end 1273 1273 set(handles.FileIndex,'String',indices) 1274 set(handles.FileIndex,'BackgroundColor',[0.7 0.7 0.7])% mark the edit box in grey, then RUN0 will mark it in white for confirmation1274 %set(handles.FileIndex,'BackgroundColor',[0.7 0.7 0.7])% mark the edit box in grey, then RUN0 will mark it in white for confirmation 1275 1275 % update the second index if relevant 1276 1276 if strcmp(get(handles.FileIndex_1,'Visible'),'on') … … 1518 1518 msgbox_uvmat('ERROR',errormsg); 1519 1519 end 1520 set(handles.runplus,'BackgroundColor',[1 0 0])%paint the command button back to red1521 1520 1522 1521 %------------------------------------------------------------------------ … … 1537 1536 msgbox_uvmat('ERROR',errormsg); 1538 1537 end 1539 set(handles.runmin,'BackgroundColor',[1 0 0])%paint the command button back to red1540 1538 1541 1539 %------------------------------------------------------------------------ … … 1619 1617 %% check for movie pair status 1620 1618 movie_status=get(handles.movie_pair,'Value'); 1621 if isequal(movie_status,1)1619 if movie_status 1622 1620 STOP_Callback(hObject, eventdata, handles)%interrupt movie pair if active 1623 1621 end … … 1635 1633 j1=str2num(get(handles.j1,'String'));%case of indexed movie 1636 1634 end 1635 if movie_status% we read the second index from the edit box 1636 i2=str2num(get(handles.i2,'String'));%read the field indices (for movie, it is not given by the file name) 1637 if strcmp(get(handles.j2,'Visible'),'on') 1638 j2=str2num(get(handles.j2,'String'));% 1639 end 1640 end 1637 1641 sub_value= get(handles.SubField,'Value'); 1638 1642 if sub_value % a second input file has been entered … … 1672 1676 end 1673 1677 1674 1678 % the pair i1-i2 or j1-j2 is free (check box CheckFixPair not selected): the list of existing indices recorded in UvData is used 1675 1679 else 1676 1680 UvData=get(handles.uvmat,'UserData'); … … 1818 1822 end 1819 1823 set(handles.InputFileREFRESH,'BackgroundColor',[1 0 0]) 1824 set(handles.runplus,'BackgroundColor',[1 0 0]) 1825 set(handles.runmin,'BackgroundColor',[1 0 0]) 1820 1826 1821 1827 %% update the index counters if the index move is successfull 1828 1822 1829 if isempty(errormsg) 1823 1830 set(handles.i1,'String',num2stra(i1,NomType,1)); … … 1846 1853 if isempty(j2), set(handles.j2,'String',''); end 1847 1854 end 1848 set(handles.i1,'BackgroundColor',[1 1 1])1849 set(handles.i2,'BackgroundColor',[1 1 1])1850 set(handles.j1,'BackgroundColor',[1 1 1])1851 set(handles.j2,'BackgroundColor',[1 1 1])1852 set(handles.FileIndex,'BackgroundColor',[1 1 1])1853 set(handles.FileIndex_1,'BackgroundColor',[1 1 1])1854 1855 end 1855 1856 … … 1862 1863 if ~get(handles.movie_pair,'value') 1863 1864 set(handles.movie_pair,'BusyAction','Cancel')%stop movie pair if button is 'off' 1864 set(handles.i2,'String','') 1865 set(handles.j2,'String','') 1866 set(handles.Dt_txt,'String','') 1865 set(handles.i2,'String','')% the second i index display is suppressed 1866 set(handles.j2,'String','')% the second j index display is suppressed 1867 set(handles.Dt_txt,'String','')% the time interval indication is suppressed 1867 1868 return 1868 else 1869 set(handles.movie_pair,'BusyAction','queue') 1870 set(handles.InputFileREFRESH,'BackgroundColor',[1 0 0]) 1871 end 1872 1873 %% initialisation 1874 set(handles.movie_pair,'BackgroundColor',[1 1 0])%paint the command button in yellow 1869 end 1870 1871 %% check the input file indexing: 1872 [RootPath,SubDir,RootFile,FileIndex,FileExt]=read_file_boxes(handles); 1873 NomType=get(handles.NomType,'String'); 1874 if ~isempty(find(regexp(NomType,'-'))) 1875 msgbox_uvmat('ERROR','The movie pair requires file series with a single index on the first input line') 1876 return 1877 end 1878 filename=[fullfile(RootPath,SubDir,RootFile) FileIndex FileExt];% build the input file name (first line) 1879 1880 set(handles.movie_pair,'BusyAction','queue')% 1881 set(handles.CheckFixPair,'Value',1)% impose fixed pair (needed for function runpm) 1882 set(handles.REFRESH,'BackgroundColor',[1 1 0])%paint the command button in yellow to indicate its activity 1883 set(handles.movie_pair,'BackgroundColor',[1 1 0])%paint the command button in yellow to indicate its activity 1875 1884 drawnow 1876 list_fields=get(handles.FieldName,'String');% list menu fields1877 index_fields=get(handles.FieldName,'Value');% selected string index1878 FieldName=list_fields{index_fields}; % selected field1879 UvData=get(handles.uvmat,'UserData'); 1880 if isequal(FieldName,'image') 1881 index=1; 1882 [RootPath,SubDir,RootFile,FileIndices,Ext]=read_file_boxes(handles);1883 NomType=get(handles.NomType,'String'); 1884 else1885 list_fields=get(handles.FieldName_1,'String');% list menu fields1886 index_fields=get(handles.FieldName_1,'Value');% selected string index1887 FieldName=list_fields{index_fields}; % selected field1888 if isequal(FieldName,'image')1889 index=2;1890 [RootPath,SubDir,RootFile,FileIndex_1,Ext,NomType]=read_file_boxes_1(handles);% get info from the second input line1891 else1892 msgbox_uvmat('ERROR','an image or movie must be first introduced as input')1893 set(handles.movie_pair,'BackgroundColor',[1 0 0])%paint the command button in red1894 set(handles.movie_pair,'Value',0)1895 return1896 end1897 end1885 % list_fields=get(handles.FieldName,'String');% list menu fields 1886 % index_fields=get(handles.FieldName,'Value');% selected string index 1887 % FieldName=list_fields{index_fields}; % selected field 1888 1889 1890 % if isequal(FieldName,'image') 1891 % index=1; 1892 1893 % else 1894 % list_fields=get(handles.FieldName_1,'String');% list menu fields 1895 % index_fields=get(handles.FieldName_1,'Value');% selected string index 1896 % FieldName=list_fields{index_fields}; % selected field 1897 % if isequal(FieldName,'image') 1898 % index=2; 1899 % [RootPath,SubDir,RootFile,FileIndex_1,Ext,NomType]=read_file_boxes_1(handles);% get info from the second input line 1900 % else 1901 % msgbox_uvmat('ERROR','an image or movie must be first introduced as input') 1902 % set(handles.movie_pair,'BackgroundColor',[1 0 0])%paint the command button in red 1903 % set(handles.movie_pair,'Value',0) 1904 % return 1905 % end 1906 % end 1898 1907 num_i1=str2num(get(handles.i1,'String')); 1899 1908 num_j1=stra2num(get(handles.j1,'String')); 1900 1909 num_i2=str2num(get(handles.i2,'String')); 1901 1910 num_j2=stra2num(get(handles.j2,'String')); 1911 1912 %% determine the name 'imaname_1' of the second file in the pair 1902 1913 imaname_1=''; 1903 if isempty(num_j2) 1914 if isempty(num_j2)% no second j index indicated 1904 1915 if isempty(num_i2) 1905 1916 if strcmp(get(handles.j2,'Visible'),'on') %if the j box is visible 1906 imaname_1=fullfile_uvmat(RootPath,SubDir,RootFile, Ext,NomType,num_i1,[],num_j1+1);1917 imaname_1=fullfile_uvmat(RootPath,SubDir,RootFile,FileExt,NomType,num_i1,[],num_j1+1); 1907 1918 end 1908 1919 if exist(imaname_1,'file') … … 1910 1921 set(handles.j2,'String',num2stra(num_j2,NomType)); 1911 1922 else 1912 imaname_1=fullfile_uvmat(RootPath,SubDir,RootFile, Ext,NomType,num_i1+1,[],num_j1);1923 imaname_1=fullfile_uvmat(RootPath,SubDir,RootFile,FileExt,NomType,num_i1+1,[],num_j1); 1913 1924 if exist(imaname_1,'file') 1914 1925 num_i2=num_i1+1; … … 1934 1945 num_j2=num_j1;%repeat the index i1 by default 1935 1946 end 1936 imaname_1=fullfile_uvmat(RootPath,SubDir,RootFile, Ext,NomType,num_i2,[],num_j2);1947 imaname_1=fullfile_uvmat(RootPath,SubDir,RootFile,FileExt,NomType,num_i2,[],num_j2); 1937 1948 if strcmp(NomType,'*') 1938 1949 num_frame=num_i2; … … 1946 1957 return 1947 1958 end 1959 1960 %% display the first field in the pair (including possibly a background field from second line input filename_1) 1961 filename_1='';%default 1962 FileIndex_1=''; 1963 if get(handles.SubField,'Value') 1964 [RootPath_1,SubDir_1,RootFile_1,FileIndex_1,FileExt_1]=read_file_boxes_1(handles); 1965 filename_1=[fullfile(RootPath_1,SubDir_1,RootFile_1) FileIndex_1 FileExt_1]; 1966 end 1967 % num_i1=stra2num(get(handles.i1,'String')); 1968 % num_i2=stra2num(get(handles.i2,'String')); 1969 % num_j1=stra2num(get(handles.j1,'String')); 1970 % num_j2=stra2num(get(handles.j2,'String')); 1971 [tild,tild,tild,i1_1,i2_1,j1_1,j2_1]=fileparts_uvmat(FileIndex_1);% get the indices of the second series from the string FileIndex_1 1972 if isempty(j1_1)% case of movies, the index is not given by file index 1973 j1_1=num_j1; 1974 end 1975 1976 errormsg=refresh_field(handles,filename,filename_1,num_i1,num_i2,num_j1,num_j2,i1_1,i2_1,j1_1,j2_1); 1977 1978 if isempty(errormsg) 1979 set(handles.REFRESH,'BackgroundColor',[1 0 0])% set button color to red, update successfull 1980 else 1981 msgbox_uvmat('ERROR',errormsg); 1982 set(handles.REFRESH,'BackgroundColor',[1 0 1])% keep button color magenta, input not succesfull 1983 end 1984 UvData=get(handles.uvmat,'UserData'); 1985 Field_a=UvData.Field;% movie on the field defined by the second input line 1948 1986 1949 1987 %% display time interval for the image pair … … 1960 1998 end 1961 1999 1962 %% get the first image 1963 %Field.AName='image'; 1964 if index==1 1965 Field_a=UvData.Field;% movie on the second field 1966 else 1967 Field_a=UvData.Field_1;% movie on the first field 1968 end 1969 1970 %% read the second image 1971 MovieObject=[]; 1972 if numel(UvData.MovieObject)>=index 1973 MovieObject=UvData.MovieObject{index}; 1974 end 1975 [Field_b,ParamOut,errormsg] = read_field(imaname_1,UvData.FileType{index},MovieObject,num_frame); 1976 1977 %px to phys or other transform on field 2000 %% read the second field 2001 if isempty(UvData.MovieObject) 2002 [Field_b,ParamOut,errormsg] = read_field(imaname_1,UvData.FileType{index},[],num_frame); 2003 else 2004 [Field_b,ParamOut,errormsg] = read_field(imaname_1,UvData.FileType{1},UvData.MovieObject{1},num_frame); 2005 end 2006 if ~isempty(errormsg) 2007 msgbox_uvmat('ERROR',['Error in reading second image: ' errormsg]) 2008 return 2009 end 2010 2011 %% apply phys or other transform on the two input fields 1978 2012 transform=get(handles.TransformPath,'UserData'); 1979 2013 if ~isempty(transform) 1980 if isfield(UvData,'XmlData') && numel(UvData.XmlData)>=index %use geometry calib recorded from the ImaDoc xml file as first priority 1981 if index==2 1982 Field_a=transform(Field_a,UvData.XmlData{index});%the first field has been stored without transform 1983 end 2014 if isfield(UvData,'XmlData') && ~isempty(UvData.XmlData) %use geometry calib recorded from the ImaDoc xml file as first priority 1984 2015 if nargin(transform)>=2 1985 Field_b=transform(Field_b,UvData.XmlData{index});2016 Field_b=transform(Field_b,UvData.XmlData{1}); 1986 2017 else 1987 Field_b=transform(Field_b);1988 end 1989 end 1990 end 1991 1992 % make movie until movie speed is set to 0 or STOP is activated2018 Field_b=transform(Field_b); 2019 end 2020 end 2021 end 2022 2023 %% make movie until movie speed is set to 0 or STOP is activated 1993 2024 hima=findobj(handles.PlotAxes,'Tag','ima');% %handles.PlotAxes =main plotting window (A GENERALISER) 1994 2025 set(handles.STOP,'Visible','on') 1995 2026 set(handles.speed,'Visible','on') 1996 2027 set(handles.speed_txt,'Visible','on') 1997 set(handles.i2,'BackgroundColor',[1 1 1])% mark the edit box in white to indicate its use as input1998 set(handles.j2,'BackgroundColor',[1 1 1])% mark the edit box in white to indicate its use as input1999 set(handles.FileIndex,'BackgroundColor',[1 1 1])% mark the edit box in white to indicate its use as input2000 2028 while get(handles.speed,'Value')~=0 && isequal(get(handles.movie_pair,'BusyAction'),'queue') % enable STOP command 2001 2029 % read and plot the series of images in non erase mode 2002 set(hima,'CData',Field_b.A); 2030 set(hima,'CData',Field_b.A); %TODO: generalise to other kinds of fields 2003 2031 pause(1.02-get(handles.speed,'Value'));% wait for next image 2004 2032 set(hima,'CData',Field_a.A); … … 2013 2041 function REFRESH_Callback(hObject, eventdata, handles) 2014 2042 %------------------------------------------------------------------------ 2015 set(handles.REFRESH,'BackgroundColor',[1 1 0])%paint the command button in yellow2043 set(handles.REFRESH,'BackgroundColor',[1 1 0])%paint the REFRESH button in yellow to indicate its activity 2016 2044 drawnow 2017 [RootPath,SubDir,RootFile,FileIndex,FileExt]=read_file_boxes(handles); 2045 [RootPath,SubDir,RootFile,FileIndex,FileExt]=read_file_boxes(handles);%read the features of the input file name (first line) 2018 2046 [tild,tild,tild,i1,i2,j1,j2]=fileparts_uvmat(FileIndex);% check back the indices used 2019 if isempty(i2), set(handles.i2,'String',''); end % suppress the second i ndex display if not used2020 if isempty(j2), set(handles.j2,'String',''); end 2021 filename=[fullfile(RootPath,SubDir,RootFile) FileIndex FileExt]; 2022 filename_1='';%default 2047 if isempty(i2), set(handles.i2,'String',''); end % suppress the second i index display if not used 2048 if isempty(j2), set(handles.j2,'String',''); end % suppress the second j index display if not used 2049 filename=[fullfile(RootPath,SubDir,RootFile) FileIndex FileExt];% build the input file name (first line) 2050 filename_1='';%default second file name 2023 2051 FileIndex_1=''; 2024 if get(handles.SubField,'Value') 2025 [RootPath_1,SubDir_1,RootFile_1,FileIndex_1,FileExt_1]=read_file_boxes_1(handles); 2026 filename_1=[fullfile(RootPath_1,SubDir_1,RootFile_1) FileIndex_1 FileExt_1]; 2052 if get(handles.SubField,'Value')% if a second file is introduced 2053 [RootPath_1,SubDir_1,RootFile_1,FileIndex_1,FileExt_1]=read_file_boxes_1(handles);%read the features of the input file name (second line) 2054 filename_1=[fullfile(RootPath_1,SubDir_1,RootFile_1) FileIndex_1 FileExt_1]; %build the input file name (second line) 2027 2055 end 2028 2056 num_i1=stra2num(get(handles.i1,'String')); … … 2034 2062 j1_1=num_j1; 2035 2063 end 2036 2064 % in case of movies the index is set by edit boxes i1 or j1 (case of movies indexed by index i) 2037 2065 errormsg=refresh_field(handles,filename,filename_1,num_i1,num_i2,num_j1,num_j2,i1_1,i2_1,j1_1,j2_1); 2038 2066 2039 if ~isempty(errormsg) 2040 msgbox_uvmat('ERROR',errormsg); 2041 set(handles.InputFileREFRESH,'BackgroundColor',[1 0 1])% keep button color magenta, input not succesfull 2042 else 2043 set(handles.i1,'BackgroundColor',[1 1 1]) 2044 set(handles.i2,'BackgroundColor',[1 1 1]) 2045 set(handles.j1,'BackgroundColor',[1 1 1]) 2046 set(handles.j2,'BackgroundColor',[1 1 1]) 2047 set(handles.FileIndex,'BackgroundColor',[1 1 1]) 2048 set(handles.FileIndex_1,'BackgroundColor',[1 1 1]) 2067 if isempty(errormsg) 2049 2068 set(handles.REFRESH,'BackgroundColor',[1 0 0])% set button color to red, update successfull 2050 end 2069 else 2070 msgbox_uvmat('ERROR',errormsg); 2071 set(handles.REFRESH,'BackgroundColor',[1 0 1])% keep button color magenta, input not succesfull 2072 end 2051 2073 2052 2074 %------------------------------------------------------------------------ … … 3554 3576 msgbox_uvmat('ERROR',errormsg); 3555 3577 else 3556 set(handles.i1,'BackgroundColor',[1 1 1])3557 set(handles.i2,'BackgroundColor',[1 1 1])3558 set(handles.j1,'BackgroundColor',[1 1 1])3559 set(handles.j2,'BackgroundColor',[1 1 1])3560 set(handles.FileIndex,'BackgroundColor',[1 1 1])3561 set(handles.FileIndex_1,'BackgroundColor',[1 1 1])3578 % set(handles.i1,'BackgroundColor',[1 1 1]) 3579 % set(handles.i2,'BackgroundColor',[1 1 1]) 3580 % set(handles.j1,'BackgroundColor',[1 1 1]) 3581 % set(handles.j2,'BackgroundColor',[1 1 1]) 3582 % set(handles.FileIndex,'BackgroundColor',[1 1 1]) 3583 % set(handles.FileIndex_1,'BackgroundColor',[1 1 1]) 3562 3584 end 3563 3585 set(handles.InputFileREFRESH,'BackgroundColor',[1 0 0]) … … 4235 4257 [tild,PlotParamOut]= plot_field(AxeData,handles.PlotAxes,PlotParam); 4236 4258 errormsg=fill_GUI(PlotParamOut,handles.uvmat); 4237 if ~isempty(errormsg) 4259 if isempty(errormsg) 4260 set(handles.REFRESH,'BackgroundColor',[1 0 0]);% operation finished, back to red color 4261 else 4238 4262 msgbox_uvmat('ERROR',errormsg) 4239 return4240 end 4241 set(handles.REFRESH,'BackgroundColor',[1 0 0]); 4263 set(handles.REFRESH,'BackgroundColor',[1 0 1]);% magenta color: graph still needs to be updated 4264 end 4265 4242 4266 4243 4267 %------------------------------------------------------------------------
Note: See TracChangeset
for help on using the changeset viewer.