Changeset 764 for trunk


Ignore:
Timestamp:
May 2, 2014, 2:03:44 AM (7 years ago)
Author:
sommeria
Message:

improvement of movie-pair for uvmat and introduction of a separate window SetPair? in series.

Location:
trunk/src
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/get_field.m

    r756 r764  
    166166set(handles.ordinate,'String',Field.Display.ListVarName)% fill the menu of y coordinate for 1D plots
    167167checkseries=0;
    168 if isfield(ParamIn,'SeriesInput') && ParamIn.SeriesInput
     168if isfield(ParamIn,'SeriesInput') && ParamIn.SeriesInput% case of call by series
    169169    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
    171175    checkseries=1;
    172176    set(handles.scalar,'Max',2)
     
    403407        ordinate_Callback(hObject, eventdata, handles)
    404408       
    405     case 'scalar'
     409    case {'scalar','pick variables'}
    406410        set(handles.Coordinates,'Visible','on')
    407411        set(handles.PanelOrdinate,'Visible','off')
     
    954958    case '1D plot'
    955959       
    956     case 'scalar'
     960    case {'scalar','pick variables'}
    957961       scalar_Callback(hObject, eventdata, handles)
    958962    case 'vectors'
    959963end
    960964
    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 FieldOption
    966     case '1D plot'
    967        
    968     case 'scalar'
    969        scalar_Callback(hObject, eventdata, handles)
    970     case 'vectors'
    971 end
    972 
    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 FieldOption
    979     case '1D plot'
    980        
    981     case 'scalar'
    982        scalar_Callback(hObject, eventdata, handles)
    983     case 'vectors'
    984 end
     965% % --- 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
    985989
    986990% --- Executes on selection change in TimeName.
  • trunk/src/keyboard_callback.m

    r726 r764  
    5151        otherwise
    5252            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
    6471            end
    6572    end
  • trunk/src/series.m

    r760 r764  
    582582    errormsg=['input file ' fileinput  ' does not exist'];
    583583    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)
    585585    return
    586586end
     
    594594    errormsg='no input file in the series';
    595595    msgbox_uvmat('ERROR',errormsg)
    596     set(handles.REFRESH,'BackgroundColor',[1 0 0])% set REFRESH  button to red color (end of activation)
     596    set(handles.REFRESH,'BackgroundColor',[1 0 1])% set REFRESH  button to magenta color (end of activation)
    597597    return
    598598end
    599599if strcmp(FileType,'txt')
    600600    edit(fileinput)
    601     set(handles.REFRESH,'BackgroundColor',[1 0 0])% set REFRESH  button to red color (end of activation)
     601    set(handles.REFRESH,'BackgroundColor',[1 0 1])% set REFRESH  button to  magenta color (end of activation)
    602602    return
    603603elseif strcmp(FileType,'xml')
    604604    editxml(fileinput)
    605     set(handles.REFRESH,'BackgroundColor',[1 0 0])% set REFRESH  button to red color (end of activation)
     605    set(handles.REFRESH,'BackgroundColor',[1 0 1])% set REFRESH  button to magenta color (end of activation)
    606606     return
    607607elseif strcmp(FileType,'figure')
    608608    open(fileinput)
    609     set(handles.REFRESH,'BackgroundColor',[1 0 0])% set REFRESH  button to red color (end of activation)
     609    set(handles.REFRESH,'BackgroundColor',[1 0 1])% set REFRESH  button to magenta color (end of activation)
    610610     return
    611611end
     
    624624
    625625
    626 
    627626%% fill the list of file series
    628627InputTable=get(handles.InputTable,'Data');
     
    630629if strcmp(iview,'append') % display the input data as a new line in the table
    631630    iview=size(InputTable,1)+1;% the next line in InputTable becomes the current line
    632     %InputTable(iview+1,:)={'','','','',''};
    633631    InputTable(iview,:)=[{RootPath},{SubDir},{RootFile},{NomType},{FileExt}];
    634632elseif strcmp(iview,'one') % refresh the list of  input  file series
    635633    iview=1; %the first line in InputTable becomes the current line
    636634    InputTable={'','','','',''};
    637     %InputTable=[{'','','','',''};{'','','','',''}];
    638635    InputTable(iview,:)=[{RootPath},{SubDir},{RootFile},{NomType},{FileExt}];
    639636    set(handles.TimeTable,'Data',[{[]},{[]},{[]},{[]}])
     
    653650    SeriesData.Time={};
    654651end
    655 %nbview=size(InputTable,1)-1;% rmq: the last line is set blank to allow manual addition of a line
    656652nbview=size(InputTable,1);
    657653set(handles.ListView,'String',mat2cell((1:nbview)',ones(nbview,1)))
    658654set(handles.ListView,'Value',iview)
     655SeriesData.ListViewValue=iview;
     656SeriesData.ListViewMenu=mat2cell((1:nbview)',ones(nbview,1));
    659657set(handles.InputTable,'Data',InputTable)
    660658
     
    668666ref_i=floor((i1+i2)/2);% reference image number corresponding to the file
    669667set(handles.num_ref_i,'String',num2str(ref_i));
    670 % set(handles.num_ref_i,'UserData',[i1 i2])%store the indices for future opening
    671668if isempty(j1)
    672669    j1=1;
     
    981978MaxIndex_i=max(MaxIndex_i);
    982979range_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 range
    986 % y=(0.5:nbview-0.5)*Position(4)/nbview;
    987980range_y=max(1,floor(Position(4)/nbview));
    988981npx=floor(Position(3));
     
    10101003    set(handles.Pairs,'Visible','on')
    10111004    set(handles.PairString,'Visible','on')
     1005    set(handles.SetPairs,'Visible','on')
    10121006else
    10131007    set(handles.Pairs,'Visible','off')
    10141008    set(handles.PairString,'Visible','off')
     1009    set(handles.SetPairs,'Visible','off')
    10151010end
    10161011
     
    10251020switch FileType
    10261021    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 data
    1029         set(handles.FieldName,'Value',2) % set menu to 'velocity
     1022        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
    10301025        set(handles.Coord_x,'Value',1);
    10311026        set(handles.Coord_x,'String',{'X'});
     
    12331228% check_burst=0;
    12341229if isempty(j2_series)% no j pair
     1230    ModeValue=1;
    12351231    if isempty(i2_series)
    1236         set(handles.mode,'Value',1)
    12371232        set(handles.mode,'String',{''})% no pair menu to display
    12381233    else   
    12391234        set(handles.mode,'Value',1)
    1240         set(handles.mode,'String',{'series(Di)'}) % pair menu with only option Di
     1235        ModeMenu={'series(Di)'}; % pair menu with only option Di
    12411236    end
    12421237else %existence of j pairs
     
    12491244    MinIndex_j=min(find(i_max))-1;% min ref index i
    12501245    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'};
    12541248    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)'};
    12571251    else
    1258         set(handles.mode,'String',{'bursts';'series(Dj)'})
     1252        ModeMenu={'bursts';'series(Dj)'};
    12591253        if (MaxIndex_j-MinIndex_j)>10
    1260             set(handles.mode,'Value',2);%set mode to series(Dj) if more than 10 j values
     1254            ModeValue=2;%set mode to series(Dj) if more than 10 j values
    12611255        else
    1262             set(handles.mode,'Value',1);
    1263 %             check_burst=1;
    1264         end
    1265     end
    1266 end
     1256            ModeValue=1;
     1257        end
     1258    end
     1259end
     1260
     1261set(handles.mode,'String',ModeMenu)
     1262set(handles.mode,'Value',ModeValue)
     1263SeriesData=get(handles.series,'UserData');
     1264SeriesData.ModeMenu=ModeMenu;
     1265SeriesData.ModeValue=ModeValue;
     1266set(handles.series,'UserData',SeriesData)
    12671267fill_ListPair(handles,i1_series,i2_series,j1_series,j2_series,time)
    12681268ListPairs_Callback([],[],handles)
     
    13691369
    13701370%% display list of pairstring
     1371SeriesData=get(handles.series,'UserData');
    13711372displ_pair_list=get(handles.ListPairs,'String');
    13721373NewVal=[];
     
    13771378if ~isempty(NewVal)
    13781379    set(handles.ListPairs,'Value',NewVal)
     1380    SeriesData.ListPairsValue=NewVal;
    13791381else
    13801382    set(handles.ListPairs,'Value',1)
     1383    SeriesData.ListPairsValue=1;
    13811384end
    13821385set(handles.ListPairs,'String',displ_pair)
     1386SeriesData.ListPairsMenu=displ_pair;
     1387set(handles.series,'UserData',SeriesData);
    13831388
    13841389%-------------------------------------
     
    14221427Param=read_GUI_series(handles);%displayed parameters
    14231428SeriesData=get(handles.series,'UserData');%hidden parameters
     1429
     1430
     1431
     1432%% select the Action mode, 'local', 'background' or 'cluster' (if available)
     1433RunMode='local';%default (needed for first opening of the GUI series)
     1434if isfield(Param.Action,'RunMode')
     1435    RunMode=Param.Action.RunMode;
     1436end
     1437ActionExt='.m';%default
     1438if isfield(Param.Action,'ActionExt')
     1439    ActionExt=Param.Action.ActionExt;% '.m' or '.sh' (compiled)
     1440end
     1441ActionName=Param.Action.ActionName;
     1442ActionPath=Param.Action.ActionPath;
     1443path_series=fileparts(which('series'));
     1444
     1445%% create the Action fct handle if RunMode option = 'local'
     1446if 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
     1461end
     1462
     1463%% Get RunTime code from the file PARAM.xml (needed to run compiled functions)
     1464errormsg='';%default error message
     1465xmlfile=fullfile(path_series,'PARAM.xml');
     1466test_batch=0;%default: ,no batch mode available
     1467if ~exist(xmlfile,'file')
     1468    [success,message]=copyfile(fullfile(path_series,'PARAM.xml.default'),xmlfile);
     1469end
     1470RunTime='';
     1471if 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
     1494end
     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
     1505if 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
     1547end
     1548
     1549%% set nbre of cluster cores and processes
     1550switch 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
     1563end
     1564if ~isfield(Param.IndexRange,'NbSlice')
     1565    Param.IndexRange.NbSlice=[];
     1566end
     1567if isempty(Param.IndexRange.NbSlice)
     1568    NbProcess=NbCore;% choose one process per core
     1569else
     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
     1572end
    14241573
    14251574%% create the output data directory if needed
     
    14781627        end
    14791628    end
    1480 end
    1481 
    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 end
    1487 ActionExt='.m';%default
    1488 if isfield(Param.Action,'ActionExt')
    1489     ActionExt=Param.Action.ActionExt;% '.m' or '.sh' (compiled)
    1490 end
    1491 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 ACTION
    1499         if ~exist(ActionPath,'dir')
    1500             msgbox_uvmat('ERROR',['The prescribed function path ' ActionPath ' does not exist']);
    1501             return
    1502         end
    1503         if ~isequal(spath,ActionPath)
    1504             addpath(ActionPath)% add the prescribed path if not the current one
    1505         end
    1506     end
    1507     eval(['h_fun=@' ActionName ';'])%create a function handle for ACTION
    1508     if ~isequal(ActionPath,path_series)
    1509         rmpath(ActionPath)% add the prescribed path if not the current one
    1510     end
    1511 end
    1512 
    1513 %% Get RunTime code from the file PARAM.xml (needed to run compiled functions)
    1514 errormsg='';%default error message
    1515 xmlfile=fullfile(path_series,'PARAM.xml');
    1516 test_batch=0;%default: ,no batch mode available
    1517 if ~exist(xmlfile,'file')
    1518     [success,message]=copyfile(fullfile(path_series,'PARAM.xml.default'),xmlfile);
    1519 end
    1520 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             end
    1528             if isfield(s.BatchParam,'NbCore')
    1529                 NbCore=s.BatchParam.NbCore;
    1530             end
    1531         elseif (strcmp(RunMode,'background')||strcmp(RunMode,'local')) && isfield(s,'RunParam')
    1532             if isfield(s.RunParam,'RunTime')
    1533                 RunTime=s.RunParam.RunTime;
    1534             end
    1535             if isfield(s.RunParam,'NbCore')
    1536                 NbCore=s.RunParam.NbCore;
    1537             end
    1538         end
    1539     end
    1540     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         return
    1543     end
    1544 end
    1545 
    1546 %% set nbre of cluster cores and processes
    1547 switch RunMode
    1548     case {'local','background'}
    1549         NbCore=1;% no need to split the calculation
    1550     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         else
    1556             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         end
    1560 end
    1561 if ~isfield(Param.IndexRange,'NbSlice')
    1562     Param.IndexRange.NbSlice=[];
    1563 end
    1564 if isempty(Param.IndexRange.NbSlice)
    1565     NbProcess=NbCore;% choose one process per core
    1566 else
    1567     NbProcess=Param.IndexRange.NbSlice;% the nbre of run processes is equal to the number of slices
    1568     NbCore=min(NbCore,NbProcess);% at least one process per core
    15691629end
    15701630       
     
    22452305    Param=read_GUI(handles.series);
    22462306    Param.InputTable=Param.InputTable(1,:);
    2247      % check the existence of the first file in the series
     2307    % check the existence of the first file in the series
    22482308    first_j=[];
    22492309    if isfield(Param.IndexRange,'first_j'); first_j=Param.IndexRange.first_j; end
     
    22552315    FirstFileName=fullfile_uvmat(Param.InputTable{1,1},Param.InputTable{1,2},Param.InputTable{1,3},...
    22562316        Param.InputTable{1,5},Param.InputTable{1,4},i1,i2,j1,j2);
    2257 %     filecell=get_file_series(Param);
    2258 %     
    22592317    if exist(FirstFileName,'file')
    22602318        ParamIn.SeriesInput=1;
     
    22662324                VName=GetFieldData.PanelVectors.vector_y;
    22672325                YName={GetFieldData.Coordinates.Coord_y};
    2268                 CName=GetFieldData.PanelVectors.vec_color;
    22692326                FieldList={['vec(' UName ',' VName ')'];...
    22702327                    ['norm(' UName ',' VName ')'];...
    22712328                    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'}
    22782330                FieldList=GetFieldData.PanelScalar.scalar;
    22792331                YName={GetFieldData.Coordinates.Coord_y};
    22802332                if ischar(FieldList)
    2281                 FieldList={FieldList};
     2333                    FieldList={FieldList};
    22822334                end
    22832335            case '1D plot'
    22842336                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';
    22872342        end
    22882343        if ~strcmp(GetFieldData.FieldOption,'civdata...')
     
    23072362                    ParamIn.TimeDimName=GetFieldData.Time.TimeName;
    23082363            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         end
     2364        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...'}]);
    23142369    end
    23152370end
     
    23212376field_str=get(handles.FieldName_1,'String');
    23222377field_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)
     2378field=field_str{field_index(1)};
     2379if 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
    23432441end   
    23442442
     
    29273025ActionList=get(handles.ActionName,'String');
    29283026ActionName=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
    29743070
    29753071
     
    30223118function series_WindowButtonMotionFcn(hObject, eventdata, handles)
    30233119set(hObject,'Pointer','arrow');
     3120
     3121
     3122% --- Executes on button press in SetPairs.
     3123function SetPairs_Callback(hObject, eventdata, handles)
     3124
     3125%% create the GUI set_pairs
     3126set(0,'Unit','points')
     3127ScreenSize=get(0,'ScreenSize');% get the size of the screen, to put the fig on the upper right
     3128Width=300;% fig width in points (1/72 inch)
     3129Height=min(0.8*ScreenSize(4),300);
     3130Left=ScreenSize(3)- Width-40; %right edge close to the right, with margin=40
     3131Bottom=ScreenSize(4)-Height-40; %put fig at top right
     3132hfig=findobj(allchild(0),'Tag','set_slice');
     3133if ~isempty(hfig),delete(hfig), end; %delete existing version of the GUI
     3134hfig=figure('name','set_pairs','tag','set_pairs','MenuBar','none','NumberTitle','off','Unit','points','Position',[Left,Bottom,Width,Height]);
     3135BackgroundColor=get(hfig,'Color');
     3136hh=0.14; % box height (relative)
     3137ii=0.01; % gap between uicontrols
     3138
     3139ww=0.9; % box width (relative)
     3140SeriesData=get(handles.series,'UserData');
     3141% first raw of the GUI
     3142uicontrol('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
     3144uicontrol('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
     3147uicontrol('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
     3149uicontrol('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
     3152uicontrol('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
     3154uicontrol('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
     3157wwp=(1-4*ii)/3; %width of the push buttons
     3158uicontrol('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');
     3160drawnow
     3161
     3162function ModeMenu_Callback(hObject,eventdata)
     3163hseries=findobj(allchild(0),'tag','series');
     3164hhseries=guidata(hseries);
     3165SeriesData=get(hseries,'UserData');
     3166hListView=findobj(get(hObject,'parent'),'Tag','ListView');
     3167iview=get(hListView,'Value');
     3168hMode=findobj(get(hObject,'parent'),'Tag','Mode');
     3169mode_list=get(hMode,'String');
     3170mode=mode_list{get(hMode,'Value')};
     3171if 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)
     3174else
     3175    enable_i(hhseries,'On')
     3176    enable_j(hhseries,'Off')
     3177end
     3178fill_ListPair(hhseries,SeriesData.i1_series{iview},SeriesData.i2_series{iview},...
     3179    SeriesData.j1_series{iview},SeriesData.j2_series{iview},SeriesData.Time{iview})
     3180ListPairs_Callback([],[],hhseries)
     3181
     3182%-------------------------------------------------------------
     3183% --- Executes on selection in ListPairs.
     3184function ListPairsMenu_Callback(hObject,eventdata)
     3185%------------------------------------------------------------
     3186list_pair=get(hObject,'String');%get the menu of image pairs
     3187if isempty(list_pair)
     3188    string='';
     3189else
     3190    string=list_pair{get(hObject,'Value')};
     3191    string=regexprep(string,',.*','');%removes time indication (after ',')
     3192end
     3193hseries=findobj(allchild(0),'tag','series');
     3194hPairString=findobj(hseries,'tag','PairString');
     3195PairString=get(hPairString,'Data');
     3196hListView=findobj(get(hObject,'parent'),'Tag','ListView');
     3197iview=get(hListView,'Value');
     3198PairString{iview,1}=string;
     3199% report the selected pair string to the table PairString
     3200set(hPairString,'Data',PairString)
     3201
     3202%-------------------------------------------------------------
     3203% --- Executes on selection in ListPairs.
     3204function OK_Callback(hObject,eventdata)
     3205%------------------------------------------------------------
     3206delete(get(hObject,'parent'))
     3207
  • trunk/src/uvmat.m

    r760 r764  
    610610%------------------------------------------------------------------------
    611611[tild,tild,tild,i1,i2,j1,j2]=fileparts_uvmat(get(handles.FileIndex,'String'));
    612 set(handles.i1,'String',num2str(i1));
     612set(handles.i1,'String',num2str(i1));%update the counters
    613613set(handles.i2,'String',num2str(i2));
    614614set(handles.j1,'String',num2str(j1));
     
    626626FileIndex=fullfile_uvmat('','','','',get(handles.NomType,'String'),i1,i2,j1,j2);
    627627set(handles.FileIndex,'String',FileIndex)
    628 % inputfilerefresh the current settings and inputfilerefresh the field view
     628% refresh the current settings and refresh the field view
    629629RootPath_Callback(hObject,eventdata,handles)
    630630
     
    12601260    case 1
    12611261        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 confirmation
     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 confirmation
    12631263    case 2
    12641264        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 confirmation
     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 confirmation
    12661266    case 3
    12671267        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 confirmation
     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 confirmation
    12691269    case 4
    12701270        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 confirmation
     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 confirmation
    12721272end
    12731273set(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 confirmation
     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 confirmation
    12751275% update the second index if relevant
    12761276if strcmp(get(handles.FileIndex_1,'Visible'),'on')
     
    15181518    msgbox_uvmat('ERROR',errormsg);
    15191519end
    1520 set(handles.runplus,'BackgroundColor',[1 0 0])%paint the command button back to red
    15211520
    15221521%------------------------------------------------------------------------
     
    15371536    msgbox_uvmat('ERROR',errormsg);
    15381537end
    1539 set(handles.runmin,'BackgroundColor',[1 0 0])%paint the command button back to red
    15401538
    15411539%------------------------------------------------------------------------
     
    16191617%% check for movie pair status
    16201618movie_status=get(handles.movie_pair,'Value');
    1621 if isequal(movie_status,1)
     1619if movie_status
    16221620    STOP_Callback(hObject, eventdata, handles)%interrupt movie pair if active
    16231621end
     
    16351633    j1=str2num(get(handles.j1,'String'));%case of indexed movie
    16361634end
     1635if 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
     1640end
    16371641sub_value= get(handles.SubField,'Value');
    16381642if sub_value % a second input file has been entered
     
    16721676    end
    16731677   
    1674     % the pair i1-i2 or j1-j2 is free (check box CheckFixPair not selected): the list of existing indices recorded in UvData is used
     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
    16751679else
    16761680    UvData=get(handles.uvmat,'UserData');
     
    18181822end
    18191823set(handles.InputFileREFRESH,'BackgroundColor',[1 0 0])
     1824set(handles.runplus,'BackgroundColor',[1 0 0])
     1825set(handles.runmin,'BackgroundColor',[1 0 0])
    18201826
    18211827%% update the index counters if the index move is successfull
     1828
    18221829if isempty(errormsg)
    18231830    set(handles.i1,'String',num2stra(i1,NomType,1));
     
    18461853        if isempty(j2), set(handles.j2,'String',''); end
    18471854    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])
    18541855end
    18551856
     
    18621863if ~get(handles.movie_pair,'value')
    18631864    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
    18671868    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
     1869end
     1870   
     1871%% check the input file indexing:
     1872[RootPath,SubDir,RootFile,FileIndex,FileExt]=read_file_boxes(handles);
     1873NomType=get(handles.NomType,'String');
     1874if ~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
     1877end
     1878filename=[fullfile(RootPath,SubDir,RootFile) FileIndex FileExt];% build the input file name (first line)
     1879
     1880set(handles.movie_pair,'BusyAction','queue')%
     1881set(handles.CheckFixPair,'Value',1)% impose fixed pair (needed for function runpm)
     1882set(handles.REFRESH,'BackgroundColor',[1 1 0])%paint the command button in yellow to indicate its activity
     1883set(handles.movie_pair,'BackgroundColor',[1 1 0])%paint the command button in yellow to indicate its activity
    18751884drawnow
    1876 list_fields=get(handles.FieldName,'String');% list menu fields
    1877 index_fields=get(handles.FieldName,'Value');% selected string index
    1878 FieldName=list_fields{index_fields}; % selected field
    1879 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 else
    1885     list_fields=get(handles.FieldName_1,'String');% list menu fields
    1886     index_fields=get(handles.FieldName_1,'Value');% selected string index
    1887     FieldName=list_fields{index_fields}; % selected field
    1888     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 line
    1891     else
    1892         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 red
    1894         set(handles.movie_pair,'Value',0)
    1895         return
    1896     end
    1897 end
     1885% 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
    18981907num_i1=str2num(get(handles.i1,'String'));
    18991908num_j1=stra2num(get(handles.j1,'String'));
    19001909num_i2=str2num(get(handles.i2,'String'));
    19011910num_j2=stra2num(get(handles.j2,'String'));
     1911
     1912%% determine the name 'imaname_1' of the second file in the pair
    19021913imaname_1='';
    1903 if isempty(num_j2)
     1914if isempty(num_j2)% no second j index indicated
    19041915    if isempty(num_i2)
    19051916        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);
    19071918        end
    19081919        if exist(imaname_1,'file')
     
    19101921            set(handles.j2,'String',num2stra(num_j2,NomType));
    19111922        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);
    19131924            if exist(imaname_1,'file')
    19141925                num_i2=num_i1+1;
     
    19341945    num_j2=num_j1;%repeat the index i1 by default
    19351946end
    1936 imaname_1=fullfile_uvmat(RootPath,SubDir,RootFile,Ext,NomType,num_i2,[],num_j2);
     1947imaname_1=fullfile_uvmat(RootPath,SubDir,RootFile,FileExt,NomType,num_i2,[],num_j2);
    19371948if strcmp(NomType,'*')
    19381949    num_frame=num_i2;
     
    19461957      return
    19471958end
     1959
     1960%% display the first field in the pair (including possibly a background field from second line input filename_1)
     1961filename_1='';%default
     1962FileIndex_1='';
     1963if 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];
     1966end
     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
     1972if isempty(j1_1)% case of movies, the index is not given by file index
     1973    j1_1=num_j1;
     1974end
     1975
     1976errormsg=refresh_field(handles,filename,filename_1,num_i1,num_i2,num_j1,num_j2,i1_1,i2_1,j1_1,j2_1);
     1977
     1978if isempty(errormsg)
     1979    set(handles.REFRESH,'BackgroundColor',[1 0 0])% set button color to red, update successfull
     1980else
     1981     msgbox_uvmat('ERROR',errormsg);
     1982     set(handles.REFRESH,'BackgroundColor',[1 0 1])% keep button color magenta, input not succesfull
     1983end
     1984UvData=get(handles.uvmat,'UserData');
     1985Field_a=UvData.Field;% movie on the field defined by the second input line
    19481986
    19491987%% display time interval for the image pair
     
    19601998end
    19611999
    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
     2001if isempty(UvData.MovieObject)
     2002    [Field_b,ParamOut,errormsg] = read_field(imaname_1,UvData.FileType{index},[],num_frame);
     2003else
     2004    [Field_b,ParamOut,errormsg] = read_field(imaname_1,UvData.FileType{1},UvData.MovieObject{1},num_frame);
     2005end
     2006if ~isempty(errormsg)
     2007    msgbox_uvmat('ERROR',['Error in reading second image: ' errormsg])
     2008    return
     2009end
     2010
     2011%% apply phys or other transform on the two input fields
    19782012transform=get(handles.TransformPath,'UserData');
    19792013if  ~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
    19842015        if nargin(transform)>=2
    1985         Field_b=transform(Field_b,UvData.XmlData{index});
     2016            Field_b=transform(Field_b,UvData.XmlData{1});
    19862017        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 activated
     2018            Field_b=transform(Field_b);
     2019        end
     2020    end
     2021end
     2022
     2023%% make movie until movie speed is set to 0 or STOP is activated
    19932024hima=findobj(handles.PlotAxes,'Tag','ima');% %handles.PlotAxes =main plotting window (A GENERALISER)
    19942025set(handles.STOP,'Visible','on')
    19952026set(handles.speed,'Visible','on')
    19962027set(handles.speed_txt,'Visible','on')
    1997 set(handles.i2,'BackgroundColor',[1 1 1])% mark the edit box in white to indicate its use as input
    1998 set(handles.j2,'BackgroundColor',[1 1 1])% mark the edit box in white to indicate its use as input
    1999 set(handles.FileIndex,'BackgroundColor',[1 1 1])% mark the edit box in white to indicate its use as input
    20002028while get(handles.speed,'Value')~=0 && isequal(get(handles.movie_pair,'BusyAction'),'queue') % enable STOP command
    20012029    % 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
    20032031    pause(1.02-get(handles.speed,'Value'));% wait for next image
    20042032    set(hima,'CData',Field_a.A);
     
    20132041function REFRESH_Callback(hObject, eventdata, handles)
    20142042%------------------------------------------------------------------------
    2015 set(handles.REFRESH,'BackgroundColor',[1 1 0])%paint the command button in yellow
     2043set(handles.REFRESH,'BackgroundColor',[1 1 0])%paint the REFRESH button in yellow to indicate its activity
    20162044drawnow
    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)
    20182046[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 index display if not used
    2020 if isempty(j2), set(handles.j2,'String',''); end
    2021 filename=[fullfile(RootPath,SubDir,RootFile) FileIndex FileExt];
    2022 filename_1='';%default
     2047if isempty(i2), set(handles.i2,'String',''); end % suppress the second i index display if not used
     2048if isempty(j2), set(handles.j2,'String',''); end % suppress the second j index display if not used
     2049filename=[fullfile(RootPath,SubDir,RootFile) FileIndex FileExt];% build the input file name (first line)
     2050filename_1='';%default second file name
    20232051FileIndex_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];
     2052if 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)
    20272055end
    20282056num_i1=stra2num(get(handles.i1,'String'));
     
    20342062    j1_1=num_j1;
    20352063end
    2036 
     2064% in case of movies the index is set by edit boxes i1 or j1 (case of movies indexed by index i)
    20372065errormsg=refresh_field(handles,filename,filename_1,num_i1,num_i2,num_j1,num_j2,i1_1,i2_1,j1_1,j2_1);
    20382066
    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]) 
     2067if isempty(errormsg)
    20492068    set(handles.REFRESH,'BackgroundColor',[1 0 0])% set button color to red, update successfull
    2050 end   
     2069else
     2070     msgbox_uvmat('ERROR',errormsg);
     2071     set(handles.REFRESH,'BackgroundColor',[1 0 1])% keep button color magenta, input not succesfull
     2072end
    20512073
    20522074%------------------------------------------------------------------------
     
    35543576        msgbox_uvmat('ERROR',errormsg);
    35553577    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])
    35623584    end
    35633585    set(handles.InputFileREFRESH,'BackgroundColor',[1 0 0])
     
    42354257[tild,PlotParamOut]= plot_field(AxeData,handles.PlotAxes,PlotParam);
    42364258errormsg=fill_GUI(PlotParamOut,handles.uvmat);
    4237 if ~isempty(errormsg)
     4259if isempty(errormsg)
     4260    set(handles.REFRESH,'BackgroundColor',[1 0 0]);% operation finished, back to red color
     4261else
    42384262    msgbox_uvmat('ERROR',errormsg)
    4239     return
    4240 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
     4264end
     4265
    42424266
    42434267%------------------------------------------------------------------------
Note: See TracChangeset for help on using the changeset viewer.