Changeset 1200


Ignore:
Timestamp:
Mar 20, 2026, 4:42:36 PM (21 hours ago)
Author:
sommeria
Message:

bug repaired for civ image rescale

Location:
trunk/src
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/mouse_motion.m

    r1195 r1200  
    3737end
    3838hhCurrentFig=guidata(hCurrentFig);%handles of the elements in the GUI containing the current figure (uvmat or view_field)
     39if isempty(hhCurrentFig)
     40    return
     41end
    3942CheckZoom=get(hhCurrentFig.CheckZoom,'Value');% check for zoom on mode
    4043CheckZoomFig=get(hhCurrentFig.CheckZoomFig,'Value');% check for zoom sub fig creation mode
  • trunk/src/mouse_up.m

    r1180 r1200  
    151151                    else
    152152                        hhview_field=guidata(hview_field);
    153                         [PlotType,PlotParam]=plot_field(ProjData,hhview_field.PlotAxes,read_GUI(hview_field));%update an existing  plot in view_field
     153                        [~,PlotParam]=plot_field(ProjData,hhview_field.PlotAxes,read_GUI(hview_field));%update an existing  plot in view_field
    154154                        errormsg=fill_GUI(PlotParam,hview_field);
    155155                    end
     
    168168                else
    169169                    UvData.PlotAxes=ProjData;
    170                     [PlotType,PlotParam]=plot_field(ProjData,hhuvmat.PlotAxes,read_GUI(huvmat));%update an existing field plot
     170                    [~,PlotParam]=plot_field(ProjData,hhuvmat.PlotAxes,read_GUI(huvmat));%update an existing field plot
    171171                    errormsg=fill_GUI(PlotParam,huvmat);
    172172                end
     
    201201
    202202%% creation or update of a  zoom sub-plot
    203 if CheckZoomFig && isequal(get(hcurrentfig,'SelectionType'),'normal')&&...%if left button has been pressed
     203CheckZoomFigActivate=CheckZoomFig && strcmp(get(hcurrentfig,'SelectionType'),'normal')&&...%if left button has been pressed
    204204     ~isempty(CurrentOrigin) && ~isequal(CurrentOrigin(1),xy(1,1)) && ~isequal(CurrentOrigin(2),xy(1,2))%if mouse moved in x and y since presed down
     205if CheckZoomFigActivate
    205206    hparentfig=hcurrentfig;
    206207    %open or update a new zoom figure if a rectangle has been drawn
    207208    if ishandle(hcurrentaxes)
    208209        if isfield(AxeData,'CurrentRectZoom') && ~isempty(AxeData.CurrentRectZoom) && ishandle(AxeData.CurrentRectZoom)
    209             %PosRect=get(AxeData.CurrentRectZoom,'Position');
    210210            if isfield(AxeData,'CurrentVec') && ~isempty(AxeData.CurrentVec) && ishandle(AxeData.CurrentVec)
    211211                delete(AxeData.CurrentVec)
     
    391391%------------------------------------------------------------------------
    392392function close_fig(ggg,eventdata,hparent)
    393 
    394 hfig=get(get(hparent,'parent'),'parent');
    395 hbutton=findobj(hfig,'Tag','CheckZoomFig');
    396 if ~isempty(hbutton)
    397     set(hbutton,'Value',0)% desactivate the zoom fig option
    398 end
    399 delete(hparent)  % delete the rectangle showing the zoom graph in the parent fig
    400 
     393if isvalid(hparent)
     394    figparent=get(hparent,'parent');
     395    if ~isempty(figparent)
     396        hfig=get(figparent,'parent');
     397        hbutton=findobj(hfig,'Tag','CheckZoomFig');
     398        if ~isempty(hbutton)
     399            set(hbutton,'Value',0)% desactivate the zoom fig option
     400        end
     401        delete(hparent)  % delete the rectangle showing the zoom graph in the parent fig
     402    end
     403end
  • trunk/src/plot_field.m

    r1195 r1200  
    178178AxeData=get(haxes,'UserData');
    179179
    180 %% 2D plots
    181 if isempty(index_2D)
    182     plot_plane([],[],haxes,[]);%removes images or vector plots in the absence of 2D field plot
     180%% 2D plots
     181if isempty(index_2D) %removes images or vector plots in the absence of 2D field plot
     182    hima=findobj(haxes,'Tag','ima');% search existing image in the current axes
     183    if  ishandle(hima)
     184        delete(hima)
     185    end
     186    hvec=findobj(haxes,'Tag','vel');% search existing vectors in the current axes
     187    if ~isempty(hvec)
     188        delete(hvec);
     189    end
    183190else  %plot 2D field
    184 %     if ~exist('PosColorbar','var'),PosColorbar=[];end;
     191    %     if ~exist('PosColorbar','var'),PosColorbar=[];end;
    185192    [~,PlotParamOut,PlotType,errormsg]=plot_plane(Data,CellInfo(index_2D),haxes,PlotParamOut);
    186193    AxeData.NbDim=2;
    187     if testzoomaxes && isempty(errormsg)
    188         [zoomaxes,PlotParamOut,~,errormsg]=plot_plane(Data,CellInfo(index_2D),zoomaxes,PlotParamOut);
     194    if testzoomaxes && isempty(errormsg)% updater the plot on the attached axis
     195        PlotParamZoom=PlotParamOut;
     196        PlotParamZoom.Axes.CheckFixLimits=1;
     197        XLim=get(zoomaxes,'XLim');
     198        YLim=get(zoomaxes,'YLim');
     199        PlotParamZoom.Axes.MinX=XLim(1);
     200        PlotParamZoom.Axes.MaxX=XLim(2);
     201        PlotParamZoom.Axes.MinY=YLim(1);
     202        PlotParamZoom.Axes.MaxY=YLim(2);
     203        PlotParamZoom.Axes.CheckZoomFig=0;
     204        [zoomaxes,~,~,errormsg]=plot_plane(Data,CellInfo(index_2D),zoomaxes,PlotParamZoom);
    189205        AxeData.ZoomAxes=zoomaxes;
    190206    end
     
    275291% --- plot 0D fields: display data values without plot
    276292%------------------------------------------------------------------
    277 function errormsg=plot_text(FieldData,CellInfo,htext)
     293function errormsg=plot_text(FieldData,CellInfo,~)
    278294
    279295errormsg='';
    280 txt_cell={};
    281 Data={};
    282296VarIndex=[];
    283 for icell=1:length(CellInfo)
    284    
     297for icell=1:length(CellInfo)   
    285298    % select types of  variables to be projected
    286299    ListProj={'VarIndex_scalar','VarIndex_image','VarIndex_color','VarIndex_vector_x','VarIndex_vector_y'};
     
    617630        end
    618631        Val=pdf2stat(x,pdf_val);
    619         Column=mat2cell(Val,ones(13,1),ones(1,size(Val,2)));
     632        Column=num2cell(Val,ones(13,1),ones(1,size(Val,2)));
    620633        if size(Val,2)==1%single component
    621634            TitleBar={VarName};
     
    665678test_ima=0; %default: test for image or map plot
    666679test_vec=0; %default: test for vector plots
    667 test_black=0;
    668680test_false=0;
    669681test_C=0;
     
    681693    ivar_Y=CellInfo{icell}.CoordIndex(end-1); % defines (unique)index for the variable representing unstructured y coordinate (default =[])
    682694    ivar_C=[];
    683     if isfield(CellInfo{icell},'VarIndex_scalar')
    684         ivar_C=[ivar_C CellInfo{icell}.VarIndex_scalar];
    685     end
    686     if isfield(CellInfo{icell},'VarIndex_image')
    687         ivar_C=[ivar_C CellInfo{icell}.VarIndex_image];
    688     end
    689     if isfield(CellInfo{icell},'VarIndex_color')
    690         ivar_C=[ivar_C CellInfo{icell}.VarIndex_color];
    691     end
    692     if isfield(CellInfo{icell},'VarIndex_ancillary')
    693         ivar_C=[ivar_C CellInfo{icell}.VarIndex_ancillary];
    694     end
    695     if numel(ivar_C)>1
    696         errormsg= 'error in plot_field: too many scalar inputs';
    697         return
    698     end
     695    ListFields=fields(CellInfo{icell});
     696    for ilist=1:numel(ListFields)
     697        if ismember(ListFields{ilist},{'VarIndex_scalar','VarIndex_image','VarIndex_color','VarIndex_ancillary'})
     698            ivar_C=CellInfo{icell}.(ListFields{ilist});
     699            break % do not allow more than one scalar
     700        end
     701    end
    699702    ivar_F=[];
    700703    if isfield(CellInfo{icell},'VarIndex_warnflag')
     
    734737            end
    735738            if isfield(PlotParam.Vectors,'ColorScalar') && ~isempty(PlotParam.Vectors.ColorScalar)
    736                 [VarVal,ListVarName,VarAttribute,errormsg]=calc_field_interp([],Data,PlotParam.Vectors.ColorScalar);
     739                [VarVal,~,~,errormsg]=calc_field_interp([],Data,PlotParam.Vectors.ColorScalar);
    737740                if ~isempty(VarVal)
    738741                    vec_C=reshape(VarVal{1},1,numel(VarVal{1}));
     
    745748                if ~isempty(ivar_F)%~(isfield(PlotParam.Vectors,'HideWarning')&& isequal(PlotParam.Vectors.HideWarning,1))
    746749                    vec_F=Data.(Data.ListVarName{ivar_F}); % warning flags for  dubious vectors
    747                     vec_FF(find(vec_F==-2))=1;%set alseFlag to 1(edge of the search box)
     750                    vec_FF(vec_F==-2)=1;%set FalseFlag to 1(edge of the search box)
    748751                end
    749752            end
     
    790793                DCoord_y_min=min(DCoord_y);
    791794                DCoord_y_max=max(DCoord_y);
    792                 if sign(DCoord_y_min)~=sign(DCoord_y_max);% =1 for increasing values, 0 otherwise
     795                if sign(DCoord_y_min)~=sign(DCoord_y_max)% =1 for increasing values, 0 otherwise
    793796                    errormsg=['errror in plot_field.m: non monotonic dimension variable ' YName ];
    794797                    return
     
    877880    if isfield(PlotParam.Scalar,'CheckBW') && ~isempty(PlotParam.Scalar.CheckBW)
    878881        ColorMap=PlotParam.Scalar.CheckBW;%PlotParam.Scalar.CheckBW is char string indicating the colormap type
    879     elseif ((siz==2) && (isa(A,'uint8')|| isa(A,'uint16')))% non color images represented in gray scale by default
     882    elseif siz==2 && (isa(A,'uint8')||isa(A,'uint16'))% non color images represented in gray scale by default
    880883        ColorMap='grayscale';
    881884    end
     
    962965        % fill the space between contours if opacity is undefined or =1
    963966        if isequal(Opacity,1)
    964             [var,hcontour]=contour(haxes,x_cont,y_cont,A,cont_pos);% determine all contours
     967            [~,hcontour]=contour(haxes,x_cont,y_cont,A,cont_pos);% determine all contours
    965968            set(hcontour,'Fill','on')% fill the space between contours
    966969            set(hcontour,'LineStyle','none')
    967970            hold on
    968971        end
    969         [var_p,hcontour_p]=contour(haxes,x_cont,y_cont,A,cont_pos_plus,'k-');% draw the contours for positive values as solid lines
     972        [~,~]=contour(haxes,x_cont,y_cont,A,cont_pos_plus,'k-');% draw the contours for positive values as solid lines
    970973        hold on
    971         [var_m,hcontour_m]=contour(haxes,x_cont,y_cont,A,cont_pos_min,'--');% draw the contours for negative values as dashed lines
     974        [~,hcontour_m]=contour(haxes,x_cont,y_cont,A,cont_pos_min,'--');% draw the contours for negative values as dashed lines
    972975        if isequal(Opacity,1)
    973976            set(hcontour_m,'LineColor',[1 1 1])% draw negative contours in white (better visibility in dark background)
     
    977980       
    978981        %determine the color scale and map
    979         caxis([abscontmin abscontmax])
     982        clim([abscontmin abscontmax])
    980983        if strcmp(ColorMap,'grayscale')
    981984            vec=linspace(0,1,(abscontmax-abscontmin)/interval);%define a greyscale colormap with steps interval
     
    10051008                    A=uint8(255*double(A)/double(MaxA));
    10061009                end
    1007 %             otherwise
    1008 %                 colormap(ColorMap);
     1010            otherwise
     1011                colormap(ColorMap);
    10091012        end
    10101013 
     
    10881091            end
    10891092            if length(PosColorbar)==4
    1090                 set(hcol,'Position',PosColorbar)
     1093                % set(hcol,'Units','pixel')
     1094                 set(hcol,'Position',PosColorbar)
    10911095            end
    10921096            %YTick=0;%default
     
    11261130    end
    11271131else%no scalar plot
    1128     if ~isempty(hima) && ishandle(hima)
     1132    if ishandle(hima)
    11291133        delete(hima)
    11301134    end
    1131     if ~isempty(PosColorbar) && ~isempty(hcol)&& ishandle(hcol)
     1135    if ~isempty(PosColorbar) && ~isempty(hcol) && ishandle(hcol)
    11321136        delete(hcol)
    11331137    end
     
    12171221    % take flags into account: add flag colors to the list of colors
    12181222    nbcolor=size(colorlist,1);
    1219 % % %     if test_black
    1220 % % %        nbcolor=nbcolor+1;
    1221 % % %        colorlist(nbcolor,:)=[0 0 0]; %add black to the list of colors
    1222 % % %        if ~isempty(ivar_FF_vec)
    1223 % % %             col_vec(vec_F~=1 & vec_F~=0 & vec_FF==0)=nbcolor;
    1224 % % %        else
    1225 % % %             col_vec(vec_F~=1 & vec_F~=0)=nbcolor;
    1226 % % %        end
    1227 % % %     end
    12281223    nbcolor=nbcolor+1;
    12291224    if ~isempty(ivar_FF_vec)
     
    13491344    arrowplus=rot*[uc;vc];
    13501345    arrowmoins=rot'*[uc;vc];
    1351     % x1=xc+uc/2-arrowplus(1,:);
    1352     % x2=xc+uc/2;
    1353     % x3=xc+uc/2-arrowmoins(1,:);
    1354     % y1=yc+vc/2-arrowplus(2,:);
    1355     % y2=yc+vc/2;
    1356     % y3=yc+vc/2-arrowmoins(2,:);
    13571346    x1=xc+uc-arrowplus(1,:);
    13581347    x2=xc+uc;
     
    13661355    matyar=reshape(matyar,1,4*n(2));
    13671356    %draw the line or modify the existing ones
    1368 %     tri=reshape(1:3*length(uc),3,[])';   
    13691357    isn=isnan(colorlist(icolor,:));%test if color NaN
    13701358    if 2*icolor > sizh(1) %if icolor exceeds the number of existing ones
     
    14321420diffy=diff(vec_Y); %difference dy=vec_Y(i+1)-vec_Y(i)
    14331421index=find(diffy);% find the indices of vec_Y after wich a change of horizontal line occurs(diffy non zero)
    1434 if isempty(index); msgbox_uvmat('ERROR','points aligned along abscissa in proj_grid.m'); return; end;%points aligned% A FAIRE: switch to line plot.
     1422if isempty(index); msgbox_uvmat('ERROR','points aligned along abscissa in proj_grid.m'); return; end%points aligned% A FAIRE: switch to line plot.
    14351423diff2=diff(diffy(index));% diff2 = fluctuations of the detected vertical grid mesh dy
    14361424if max(abs(diff2))>0.001*abs(diffy(index(1))) % if max(diff2) is larger than 1/1000 of the first mesh dy
     
    14891477    end
    14901478    if test_interp==1%if we interpolate
    1491         xi=[rangx(1):(rangx(2)-rangx(1))/(npxy(2)-1):rangx(2)];
    1492         yi=[rangy(1):(rangy(2)-rangy(1))/(npxy(1)-1):rangy(2)];
     1479        xi=rangx(1):(rangx(2)-rangx(1))/(npxy(2)-1):rangx(2);
     1480        yi=rangy(1):(rangy(2)-rangy(1))/(npxy(1)-1):rangy(2);
    14931481        [XI,YI]=meshgrid(xi,yi);
    14941482        A = interp2(X,Y,B,XI,YI);
  • trunk/src/series.m

    r1199 r1200  
    165165RunModeList={'local';'background'}; % default choice of extensions (Matlab fct .m or compiled version .sh)
    166166if isfield(SeriesData.ClusterParam, 'ExistenceTest')
    167     oarcommand=SeriesData.ClusterParam.ExistenceTest;
    168     s=system(oarcommand); % look for cluster system presence
     167    ClusterExistenceTest=SeriesData.ClusterParam.ExistenceTest;
     168    disp('look for cluster command available')
     169    s=system(ClusterExistenceTest); % look for cluster system presence
    169170    if isequal(s,0)% cluster detected
    170171        RunModeList=[RunModeList;{'cluster'}];
     
    568569%------------------------------------------------------------------------
    569570CheckRelabel=get(handles.Relabel,'Value');
    570 check_input_file_series(handles,CheckRelabel)
    571 
    572 %% enable field and veltype menus, in accordance with the current action
     571errormsg=check_input_file_series(handles,CheckRelabel);
     572if ~isempty(errormsg)
     573    msgbox_uvmat('ERROR',errormsg);% no input files entered
     574    set(handles.REFRESH,'BackgroundColor',[1 0 0])% set REFRESH  back to red color
     575    return
     576end
     577
     578%% enable field and veltype menus, in accordance with the current action function
    573579ActionInput_Callback([],[], handles)
    574580
    575581%------------------------------------------------------------------------
    576582% --- check the input file series.
    577 function check_input_file_series(handles,CheckRelabel)
     583function errormsg=check_input_file_series(handles,CheckRelabel)
    578584%------------------------------------------------------------------------
    579585InputTable=get(handles.InputTable,'Data');%read the table of input file series
    580586set(handles.series,'Pointer','watch') % set the mouse pointer to 'watch'
    581587set(handles.REFRESH,'BackgroundColor',[1 1 0])% set REFRESH  button to yellow color (indicate activation)
    582 set(handles.Relabel,'BackgroundColor',[0 1 0])
    583588drawnow
    584 empty_line=false(size(InputTable,1),1);
     589errormsg='';%default
     590
     591%% removes possible  empty lines in the tables documenting the files index series
     592check_empty_line=false(size(InputTable,1),1);
    585593for iline=1:size(InputTable,1)
    586     empty_line(iline)= isempty(cell2mat(InputTable(iline,1:3)));%check the empty lines in the input table
    587 end
    588 if ~isempty(find(empty_line,1))%removes the empty lines in the table
    589     InputTable(empty_line,:)=[]; % remove empty lines
     594    check_empty_line(iline)= isempty(cell2mat(InputTable(iline,1:3)));%check the empty lines in the input table
     595end
     596empty_lines=find(check_empty_line);%line indices which are empty
     597if numel(empty_lines)==size(InputTable,1)
     598   errormsg='input files needed';% no input files
     599    return
     600end
     601if ~isempty(empty_lines)
     602    InputTable(empty_lines,:)=[]; % remove empty lines
    590603    set(handles.InputTable,'Data',InputTable)
    591604    ListTable={'MinIndex_i','MaxIndex_i','MinIndex_j','MaxIndex_j','PairString','TimeTable'};
    592605    for ilist=1:numel(ListTable)
    593606        Table=get(handles.(ListTable{ilist}),'Data');
    594         Table(empty_line,:)=[]; % remove empty lines
     607        Table(empty_lines,:)=[]; % remove empty lines
    595608        set(handles.(ListTable{ilist}),'Data',Table);
    596609    end
    597610    set(handles.series,'UserData',[])%refresh the stored info
    598611end
    599 nbview=size(InputTable,1);
    600 CheckRelabelQuest=false;
     612nbview=size(InputTable,1);% number of lines filled in the Input file table after this cleaning of empty lines
     613
     614%% get info on each line of the input table
     615CheckRelabelQuest=true;% will ask for relabeling if relevant
    601616for iview=1:nbview
    602     RootPath=fullfile(InputTable{iview,1},InputTable{iview,2});
    603     Param.Relabel=false;
     617    RootPath=fullfile(InputTable{iview,1},InputTable{iview,2});% path of the input file series
     618    Param.Relabel=false;% no relabeling by default
    604619    MovieObject=[];
    605620    Param.FileInfo=[];
    606621    if ~exist(RootPath,'dir')
    607622        Param.i1_series=[];
    608         RootFile='';
     623        RootFile='';% input folder does not exist, will ask by browser
    609624    else
    610         [XmlFileName,Rank]=find_imadoc(InputTable{iview,1},InputTable{iview,2});
     625        [XmlFileName,Rank]=find_imadoc(InputTable{iview,1},InputTable{iview,2});%look for ImaDoc file
    611626        if ~isempty(XmlFileName)
    612             XmlData=read_imadoc(XmlFileName);
    613             if  Rank==0 && ~isempty(XmlData.FileSeries)
    614                 set(handles.Relabel,'Visible','on')
     627            XmlData=read_imadoc(XmlFileName);%read the imadoc file through the local fct read_imadoc
     628            if  Rank==0 && ~isempty(XmlData.FileSeries)% file relabeling proposed in the xml file
     629                set(handles.Relabel,'Visible','on')% make the relabel check box visible
    615630                answer='Yes';
    616                 if ~CheckRelabel && ~CheckRelabelQuest% propose to relabel if not selected yet
     631                if ~CheckRelabel && CheckRelabelQuest% propose to relabel if not selected yet
    617632                    answer=msgbox_uvmat('INPUT_Y-N','relabel the frame  indices according to the xml info?');
    618                     CheckRelabelQuest=true;
     633                    CheckRelabelQuest=false;% will validate the answer for all lines
    619634                end
    620                 if strcmp(answer,'Yes')
    621                     set(handles.Relabel,'Value',1)
     635                if strcmp(answer,'Yes')% relabel option activated
     636                    set(handles.Relabel,'Value',1)% activate the relabel option
     637                    CheckRelabel=true;
    622638                    NomType='*';
    623639                    i1=1;i2=[];j1=1;j2=[];
     
    633649                    FirstFile=fullfile(InputTable{iview,1},InputTable{iview,2},XmlData.FileSeries.FileName{1});
    634650                    if ~exist(FirstFile,'file')
    635                         msgbox_uvmat('ERROR',[FirstFile ' does not exist']);
     651                        errormsg=[FirstFile ' set by the xml file does not exist'];
    636652                        return
    637653                    end
    638                     [Param.FileInfo,VideoObject]=get_file_info(FirstFile);
     654                    Param.FileInfo=get_file_info(FirstFile);
    639655                else
    640                     set(handles.Relabel,'Value',0)
     656                    set(handles.Relabel,'Value',0) % suppress the relabel option
    641657                end
    642658            end
     
    647663        %scan the input folder
    648664        InputTable{iview,3}=regexprep(InputTable{iview,3},'^/','');%suppress '/' at the beginning of the input name
    649         i1=str2double(get(handles.num_first_i,'String'));
    650         j1=str2double(get(handles.num_first_j,'String'));
    651         j2=[];%default
    652 %         PairString=get(handles.PairString,'Data');
    653 %         if numel(PairString)>=iview
    654 %             r=regexp(PairString{iview},'(?<num1>\d+)-(?<num2>\d+)' ,'names');
    655 %             if ~isempty(r)
    656 %                 j1=str2double(r.num1);
    657 %                 j2=str2double(r.num2);
    658 %             end
    659 %         end
    660  InputFile=[InputTable{iview,3} InputTable{iview,4} InputTable{iview,5}];
    661         %InputFile=fullfile_uvmat('','',InputTable{iview,3},InputTable{iview,5},InputTable{iview,4},i1,[],j1,j2);
     665        InputFile=[InputTable{iview,3} InputTable{iview,4} InputTable{iview,5}];
    662666        [RootPath,~,RootFile,Param.i1_series,Param.i2_series,Param.j1_series,Param.j2_series,~,Param.FileInfo,MovieObject]=...
    663667            find_file_series(fullfile(InputTable{iview,1},InputTable{iview,2}),InputFile);
    664668    end
    665669
    666     % if no file is found on line #ivew, open a browser
     670    % if no file is found on line #iview, open a browser
    667671    if ~Param.Relabel && isempty(RootFile)&& isempty(Param.i1_series)
    668672        fileinput=uigetfile_uvmat(['wrong input at line ' num2str(iview) ':pick a new input file'],RootPath);
    669673        if isempty(fileinput)
    670             set(handles.REFRESH,'BackgroundColor',[1 0 0])% set REFRESH  back to red color
     674            errormsg='no input file entered';
    671675            return
    672676        else
    673             display_file_name(handles,fileinput,iview)% update the table of input file series, then call update_rootinfo
     677            display_file_name(handles,fileinput,iview)% update the table of input file series #iview, then will call update_rootinfo
    674678        end
    675679    else
     
    678682end
    679683
    680 %% update MinIndex_i and MaxIndex_i if the input table content has been reduced in line nbre
     684%% suppress possible remaining data beyond nbview lines in MinIndex_i, MaxIndex_i ,MinIndex_j, MaxIndex_j,PairString,TimeTable
    681685MinIndex_i_table=get(handles.MinIndex_i,'Data'); % retrieve the min indices in the table MinIndex
    682 set(handles.MinIndex_i,'Data',MinIndex_i_table(1:nbview,:));
     686set(handles.MinIndex_i,'Data',MinIndex_i_table(1:nbview)); % save only the nbviews values, remove possible values beyond
     687
    683688MinIndex_j_table=get(handles.MinIndex_j,'Data'); % retrieve the min indices in the table MinIndex
    684 set(handles.MinIndex_j,'Data',MinIndex_j_table(1:nbview,:));
    685 MaxIndex_i_table=get(handles.MaxIndex_i,'Data'); % retrieve the min indices in the table MinIndex
    686 
    687 set(handles.MaxIndex_i,'Data',MaxIndex_i_table(1:nbview,:));
     689set(handles.MinIndex_j,'Data',MinIndex_j_table(1:nbview));
     690
     691MaxIndex_i_table=get(handles.MaxIndex_i,'Data'); % retrieve the max indices in the table MinIndex
     692set(handles.MaxIndex_i,'Data',MaxIndex_i_table(1:nbview));
     693
    688694MaxIndex_j_table=get(handles.MaxIndex_j,'Data'); % retrieve the min indices in the table MinIndex
    689 set(handles.MaxIndex_j,'Data',MaxIndex_j_table(1:nbview,:));
     695set(handles.MaxIndex_j,'Data',MaxIndex_j_table(1:nbview));
     696
    690697PairString=get(handles.PairString,'Data'); % retrieve the min indices in the table MinIndex
    691 set(handles.PairString,'Data',PairString(1:nbview,:));
     698set(handles.PairString,'Data',PairString(1:nbview));
     699
    692700TimeTable=get(handles.TimeTable,'Data'); % retrieve the min indices in the table MinIndex
    693701set(handles.TimeTable,'Data',TimeTable(1:nbview,:));
    694702
    695 
    696703set(handles.REFRESH,'BackgroundColor',[1 0 0])% set REFRESH  button to red color (indicate activation finished)
    697704set(handles.series,'Pointer','arrow') % set the mouse pointer to 'watch'
    698 
    699705
    700706
     
    750756XmlData=[];
    751757if ~isempty(XmlFileName)
    752     XmlData=read_imadoc(XmlFileName);
     758    XmlData=read_imadoc(XmlFileName);%read the imadoc file through the local fct read_imadoc
    753759    if isfield(XmlData,'FileSeries') && Rank==0
    754760        set(handles.Relabel,'Visible','on')
     
    925931    SeriesData.InputPath=InputPath;
    926932end
    927 
    928 
    929933set(handles.series,'UserData',SeriesData)
    930 
    931934set(handles.InputTable,'BackgroundColor',[1 1 1])
    932 
    933 
    934935
    935936%% initiate input file series and refresh the current field view:
     
    947948% --- get info from the xml file XmlFileName
    948949function XmlData=read_imadoc(XmlFileName)
    949 
     950%------------------------------------------------------------------------
    950951[XmlData,errormsg]=imadoc2struct(XmlFileName);
    951952if ~isempty(errormsg)
     
    10111012    if isempty(i1_series)
    10121013        MinIndex_j=1;MaxIndex_j=1;MinIndex_i=1;MaxIndex_i=1;
    1013     elseif size(i1_series,2)==2 && min(min(i1_series(:,1,:)))==0
     1014    elseif size(i1_series,2)==2 && min(min(i1_series(:,1,:)))==0 % file series with a single index i
    10141015        MinIndex_j=1; % index j set to 1 by default
    10151016        MaxIndex_j=1;
     
    10261027        diff_i_max=diff(ref_i);
    10271028        if ~isempty(diff_i_max) && isequal (diff_i_max,diff_i_max(1)*ones(size(diff_i_max)))
    1028             set(handles.num_incr_i,'String',num2str(diff_i_max(1)))% detect an increment to dispaly by default
     1029            set(handles.num_incr_i,'String',num2str(diff_i_max(1)))% detect an increment to display by default
    10291030        end
    10301031        if ~isempty(diff_j_max) && isequal (diff_j_max,diff_j_max(1)*ones(size(diff_j_max)))
     
    10781079        InputTable=get(handles.InputTable,'Data');
    10791080        [XmlFileName,Rank]=find_imadoc(InputTable{iview,1},InputTable{iview,2});
    1080         if isempty(XmlFileName)
    1081             return
    1082         else
     1081        if ~isempty(XmlFileName)
    10831082            Param.XmlData=read_imadoc(XmlFileName);
    1084         end
    1085         [nbfield,nbfield_j]=size(Param.XmlData.Time);
    1086         nbfield=nbfield-1; %remove the possible index 0
    1087         nbfield_j=nbfield_j-1; %remove the possible index 0
    1088 %         MaxIndex_i=get(handles.MaxIndex_i,'Data');
    1089 %         MaxIndex_j=get(handles.MaxIndex_j,'Data');
    1090 %         MaxIndex_i(1,:)=nbfield;
    1091 %         MaxIndex_j(1,:)=nbfield_j;
    1092 %         MinIndex_i(1,:)=1;
    1093 %         MinIndex_j(1,:)=1;
    1094          MaxIndex_i=nbfield;
    1095          MaxIndex_j=nbfield_j;
    1096          MinIndex_i=1;
    1097          MinIndex_j=1;
    1098 
     1083            [nbfield,nbfield_j]=size(Param.XmlData.Time);
     1084            nbfield=nbfield-1; %remove the possible index 0
     1085            nbfield_j=nbfield_j-1; %remove the possible index 0
     1086            MaxIndex_i=nbfield;
     1087            MaxIndex_j=nbfield_j;
     1088            MinIndex_i=1;
     1089            MinIndex_j=1;
     1090        end
    10991091
    11001092        first_i=str2double(get(handles.num_first_i,'String'));
     
    11151107
    11161108%% determine the min and max times: case of Netcdf files will be treated later in FieldName_Callback
    1117 if ~isempty(TimeName)
     1109if isempty(TimeName)
     1110    TimeMin=NaN;    TimeMax=NaN;  TimeFirst=NaN;    TimeLast=NaN;
     1111else
    11181112    if size(Time)<[MaxIndex_i+1 MaxIndex_j+1]
    1119         msgbox_uvmat('WARNING',['incomplete time info in xml file']);
     1113        msgbox_uvmat('WARNING','incomplete time info in xml file');
    11201114    end
    11211115    TimeMin=Time(MinIndex_i+1,MinIndex_j+1);
     
    11431137set(handles.MaxIndex_j,'Data',MaxIndex_j_table)%display the max indices in the table MaxIndex
    11441138
    1145 if isfield(Param.XmlData,'NbSlice') && ~isempty(Param.XmlData.NbSlice)
     1139if isfield(Param,'XmlData') && isfield(Param.XmlData,'NbSlice') && ~isempty(Param.XmlData.NbSlice)
    11461140    set(handles.num_NbSlice,'String',num2str(Param.XmlData.NbSlice))
    11471141    set(handles.num_NbSlice,'Visible','on')
     
    12231217SeriesData.j1_series{iview}=j1_series;
    12241218SeriesData.j2_series{iview}=j2_series;
    1225 %     SeriesData.FileType{iview}=FileInfo.FileType;
    12261219SeriesData.FileInfo{iview}=Param.FileInfo;
    12271220SeriesData.Time{iview}=Time;
     
    18821875        drawnow
    18831876    end
    1884     if get(handles.Replicate,'Value')
     1877    if get(handles.Replicate,'Value')%resset the input file settings in case of replicated processing
    18851878        set(handles.InputTable,'Data',Param.InputTable)
    18861879        set(handles.OutputPath,'String',OutputPath)
     
    24162409%------------------------------------------------------------------------
    24172410% --- read parameters from the GUI series
    2418 %------------------------------------------------------------------------
    24192411function Param=read_GUI_series(handles)
    2420 
    2421 %% read raw parameters from the GUI series
     2412%------------------------------------------------------------------------
     2413
     2414% read raw parameters from the GUI series
    24222415Param=read_GUI(handles.series);
    24232416
     
    25592552set(handles.num_CPUTime,'String','')
    25602553
     2554%------------------------------------------------------------------------
    25612555% --- Executes on button press in ActionInput.
    25622556function ActionInput_Callback(hObject, eventdata, handles)
     2557%------------------------------------------------------------------------
    25632558
    25642559set(handles.ActionInput,'BackgroundColor',[1 1 0])
     
    30933088end
    30943089
    3095 
     3090%------------------------------------------------------------------------
    30963091function [TimeValue,DtValue]=get_time(ref_i,ref_j,PairString,InputTable,FileInfo,TimeName,DtName)
     3092%------------------------------------------------------------------------
    30973093[i1,i2,j1,j2] = get_file_index(ref_i,ref_j,PairString);
    30983094FileName=fullfile_uvmat(InputTable{1},InputTable{2},InputTable{3},InputTable{5},InputTable{4},i1,i2,j1,j2);
     
    31823178end
    31833179
    3184 
    3185 %%%%%%%%%%%%%
     3180%------------------------------------------------------------------------
    31863181function [ind_remove]=find_pairs(dirpair,ind_i,last_i)
     3182%------------------------------------------------------------------------
    31873183indsel=ind_i;
    31883184indiff=diff(ind_i); % test index increment to detect multiplets (several pairs with the same index ind_i) and holes in the series
     
    33073303%------------------------------------------------------------------------
    33083304% --- Executes on button press in ViewObject.
    3309 %------------------------------------------------------------------------
    33103305function ViewObject_Callback(hObject, eventdata, handles)
     3306%------------------------------------------------------------------------
    33113307
    33123308UserData=get(handles.series,'UserData');
     
    33603356%------------------------------------------------------------------------
    33613357% --- Executed when CheckMask is activated
    3362 %------------------------------------------------------------------------
    33633358function CheckMask_Callback(hObject, eventdata, handles)
     3359%------------------------------------------------------------------------
    33643360% SeriesData=get(handles.series,'UserData');
    33653361
     
    34843480%------------------------------------------------------------------------
    34853481% --- Executes when selected cell(s) is changed in MaskTable.
    3486 %------------------------------------------------------------------------
    34873482function MaskTable_CellSelectionCallback(hObject, eventdata, handles)
    3488 
     3483%------------------------------------------------------------------------
    34893484if numel(eventdata.Indices)>=1
    34903485set(handles.ListMask,'Value',eventdata.Indices(1))
     
    34943489function MenuHelp_Callback(hObject, eventdata, handles)
    34953490%-------------------------------------------------------------------
    3496 
    3497 
    3498 % path_to_uvmat=which ('uvmat'); % check the path of uvmat
    3499 % pathelp=fileparts(path_to_uvmat);
    3500 % helpfile=fullfile(pathelp,'uvmat_doc','uvmat_doc.html');
    3501 % if isempty(dir(helpfile)), msgbox_uvmat('ERROR','Please put the help file uvmat_doc.html in the sub-directory /uvmat_doc of the UVMAT package')
    3502 % else
    3503 %     addpath (fullfile(pathelp,'uvmat_doc'))
    3504 %     web([helpfile '#series'])
    3505 % end
     3491web('https://legi.gricad-pages.univ-grenoble-alpes.fr/soft/uvmat-doc/help')
    35063492
    35073493%-------------------------------------------------------------------
     
    35803566%------------------------------------------------------------------------
    35813567% --- fct activated by the upper bar menu ExportConfig
    3582 %------------------------------------------------------------------------
    35833568function MenuDisplayConfig_Callback(hObject, eventdata, handles)
    3584 
     3569%------------------------------------------------------------------------
    35853570global Param
    35863571Param=read_GUI_series(handles);
    35873572evalin('base','global Param')%make CurData global in the workspace
    3588 display('current series config :')
     3573disp('current series config :')
    35893574evalin('base','Param') %display CurData in the workspace
    35903575commandwindow; % brings the Matlab command window to the front
     
    35953580%------------------------------------------------------------------------
    35963581function MenuImportConfig_Callback(hObject, eventdata, handles)
     3582%------------------------------------------------------------------------
    35973583
    35983584%% use a browser to choose the xml file containing the processing config
     
    36683654
    36693655%------------------------------------------------------------------------
    3670 % --- Executes when the GUI series is resized.
    3671 %------------------------------------------------------------------------
     3656% --- Executes when the GUI series is resized.-
    36723657function series_ResizeFcn(hObject, eventdata, handles)
    3673 
    3674 %% input table
     3658%------------------------------------------------------------------------
     3659
     3660% input table
    36753661set(handles.InputTable,'Unit','pixel')
    36763662Pos=get(handles.InputTable,'Position');
     
    37133699set(handles.PairString,'ColumnWidth',{Pos(3)-5})
    37143700
    3715 %% MaskTable
    3716 % % set(handles.MaskTable,'Unit','pixel')
    3717 % % Pos=get(handles.MaskTable,'Position');
    3718 % % set(handles.MaskTable,'Unit','normalized')
    3719 % % set(handles.MaskTable,'ColumnWidth',{Pos(3)-5})
    3720 
    3721 %------------------------------------------------------------------------
    3722 % --- Executes on button press in status.
    3723 %------------------------------------------------------------------------
     3701%------------------------------------------------------------------------
     3702% --- Executes on button press in status.-
    37243703function status_Callback(hObject, eventdata, handles)
    3725 
     3704%------------------------------------------------------------------------
    37263705if get(handles.status,'Value')
    37273706    set(handles.status,'BackgroundColor',[1 1 0])
     
    37523731end
    37533732
    3754 
    37553733%------------------------------------------------------------------------
    37563734% launched by selecting a file on the list
    3757 %------------------------------------------------------------------------
    37583735function view_file(hObject, eventdata)
    3759 
     3736%------------------------------------------------------------------------
    37603737list=get(hObject,'String');
    37613738index=get(hObject,'Value');
     
    37943771end
    37953772
    3796 
    37973773%------------------------------------------------------------------------
    37983774% launched by refreshing the status figure
    3799 %------------------------------------------------------------------------
    38003775function refresh_GUI(hfig)
    3801 
     3776%------------------------------------------------------------------------
    38023777htitlebox=findobj(hfig,'tag','titlebox');
    38033778hlist=findobj(hfig,'tag','list');
     
    38583833%------------------------------------------------------------------------
    38593834% --- Executes on selection change in ActionExt.
    3860 %------------------------------------------------------------------------
    38613835function ActionExt_Callback(hObject, eventdata, handles)
    3862 
     3836%------------------------------------------------------------------------
    38633837ActionExtList=get(handles.ActionExt,'String');
    38643838ActionExt=ActionExtList{get(handles.ActionExt,'Value')};
     
    39123886menu=menu(imin:imax);
    39133887
    3914 
    3915 % --- Executes on mouse motion over figure - except title and menu.
    3916 % function series_WindowButtonMotionFcn(hObject, eventdata, handles)
    3917 % set(hObject,'Pointer','arrow');
    3918 
    3919 
     3888%------------------------------------------------------------------------
    39203889% --- Executes on button press in SetPairs.
    39213890function SetPairs_Callback(hObject, eventdata, handles)
    3922 
     3891%------------------------------------------------------------------------
    39233892%% delete previous occurrence of 'set_pairs'
    39243893hfig=findobj(allchild(0),'Tag','set_pairs');
     
    40063975%------------------------------------------------------------------------
    40073976function ListView_Callback(hObject,eventdata)
     3977%------------------------------------------------------------------------
    40083978Mode_Callback(hObject,eventdata)
    40093979
    40103980%------------------------------------------------------------------------
    40113981function Mode_Callback(hObject,eventdata)
     3982%------------------------------------------------------------------------
    40123983%% get input info
    40133984hseries=findobj(allchild(0),'tag','series'); % handles of the GUI series
     
    40253996
    40263997%% enable j index visibility after the new choice
    4027 
    40283998if strcmp(mode,'series(Dj)')
    40293999   status_j='on'; % default
     
    40734043set(hPairString,'Data',PairString)
    40744044
    4075 
    40764045%------------------------------------------------------------------------
    40774046function num_ref_i_Callback(hObject, eventdata)
     
    40894058delete(get(hObject,'parent'))
    40904059
    4091 
    40924060%------------------------------------------------------------------------
    40934061% --- Executes on button press in ClearLine.
    4094 %------------------------------------------------------------------------
    40954062function ClearLine_Callback(hObject, eventdata, handles)
     4063%------------------------------------------------------------------------
    40964064InputTable=get(handles.InputTable,'Data');
    40974065iline=str2double(get(handles.InputLine,'String'));
     
    41024070set(handles.REFRESH,'BackgroundColor',[1 0 1])% set REFRESH button to magenta color to indicate that input refr
    41034071
    4104 
     4072%------------------------------------------------------------------------
    41054073% --- Executes on button press in MonitorCluster.
    41064074function MonitorCluster_Callback(hObject, eventdata, handles)
    4107 
     4075%------------------------------------------------------------------------
    41084076[rr,ss]=system('oarstat |grep N=UVmat');% check the list of jobs launched with uvmat
    41094077if isempty(ss)
     
    41144082end
    41154083
    4116 
     4084%------------------------------------------------------------------------
    41174085function OutputSubDir_Callback(hObject, eventdata, handles)
     4086%------------------------------------------------------------------------
    41184087set(handles.OutputSubDir,'BackgroundColor',[1 1 1])
    41194088
     
    41244093% --- Executes on button press in TestCPUTime.
    41254094function TestCPUTime_Callback(hObject, eventdata, handles)
    4126 % hObject    handle to TestCPUTime (see GCBO)
    4127 % eventdata  reserved - to be defined in a future version of MATLAB
    4128 % handles    structure with handles and user data (see GUIDATA)
    4129 
    4130 
     4095
     4096%------------------------------------------------------------------------
    41314097% --- Executes on button press in DiskQuota.
    41324098function DiskQuota_Callback(hObject, eventdata, handles)
     4099%------------------------------------------------------------------------
    41334100SeriesData=get(handles.series,'UserData');
    41344101system(SeriesData.DiskQuotaCmd)
    41354102
    4136 
     4103%------------------------------------------------------------------------
    41374104% --- Executes on button press in Replicate.
    41384105function Replicate_Callback(hObject, eventdata, handles)
     4106%------------------------------------------------------------------------
    41394107if get(handles.Replicate,'Value')
    41404108    InputTable=get(handles.InputTable,'Data');
     
    41594127function Device_Callback(hObject, eventdata, handles)
    41604128
    4161 
     4129%------------------------------------------------------------------------
    41624130% --- Executes on button press in OutputPathBrowse.
    41634131function OutputPathBrowse_Callback(hObject, eventdata, handles)
     4132%------------------------------------------------------------------------
    41644133CheckValue=get(handles.OutputPathBrowse,'Value');
    41654134if CheckValue
     
    41714140end
    41724141
    4173 
     4142%------------------------------------------------------------------------
    41744143% --- Executes on button press in DeleteMask.
    41754144function DeleteMask_Callback(hObject, eventdata, handles)
     4145%------------------------------------------------------------------------
    41764146set(handles.MaskTable,'Data',{})
    41774147
    4178 
     4148%------------------------------------------------------------------------
    41794149% --- Executes on button press in Relabel.
    41804150function Relabel_Callback(hObject, eventdata, handles)
     4151%------------------------------------------------------------------------
    41814152CheckRelabel=get(hObject,'Value');
    41824153if CheckRelabel
     
    41954166    end
    41964167end
    4197 check_input_file_series(handles,CheckRelabel)
    4198 ActionInput_Callback([],[], handles)
    4199 
    4200 
     4168check_input_file_series(handles,CheckRelabel)% check the min and max relabeled indices, or original ones if CheckRelabel=false
     4169ActionInput_Callback([],[], handles)% %% enable menus (field, vel type,...), in accordance with the current action function
     4170
     4171
  • trunk/src/series.xml.default

    r1171 r1200  
    66      <NbCoreAdvised>16</NbCoreAdvised>                        <!-- proposed default number of parallel cores attributed for the computations -->
    77      <NbCoreMax>36</NbCoreMax>                                <!-- maximum number of cores allowed for the computations -->
    8       <JobCPUTimeAdvised unit="minute">20</JobCPUTimeAdvised>  <!-- used to group the iterations into jobs of sufficient CPU time -->
     8      <JobCPUTimeAdvised unit="minute">60</JobCPUTimeAdvised>  <!-- used to group the iterations into jobs of sufficient CPU time -->
    99      <JobNumberMax>500</JobNumberMax>                         <!-- maximum number of jobs allowed (will group the iterations to fit in) -->
    1010      <WallTimeMax unit="hour">23</WallTimeMax>                <!-- maximum allowed time for a job -->
  • trunk/src/series/civ_input.m

    r1199 r1200  
    8989FileType='image';%fdefault
    9090FileInfo=[];
    91 if isfield(SeriesData,'FileInfo')
     91if isfield(SeriesData,'FileInfo') && ~isempty(SeriesData.FileInfo)
    9292    FileType=SeriesData.FileInfo{1}.FileType;% info on the first input file series
    9393else
  • trunk/src/series/civ_series.m

    r1199 r1200  
    392392            [par_civ1.ImageB,VideoObject_B] = read_image(ImageName_B,FileType_B,VideoObject_B,FrameIndex_B);
    393393           
    394         % catch ME % display errors in reading input images
    395         %     if ~isempty(ME.message)
    396         %         disp_uvmat('ERROR', ['error reading input image: ' ME.message],checkrun)
    397         %         continue
    398         %     end
    399         % end
    400394       
    401395        % case of background image to subtract
    402396        if par_civ1.CheckBackground &&~isempty(par_civ1.Background)
    403397            [RootPath_background,SubDir_background,RootFile_background,~,~,~,~,Ext_background]=fileparts_uvmat(Param.ActionInput.Civ1.Background);
    404             if ~isempty(i2_series_Civ1)% case of volume,backgrounds act on different j levels
     398            if strcmp(NomTypeNc,'_1-2_1')% case of volume,backgrounds act on different j levels
    405399                backgroundname=fullfile_uvmat(RootPath_background,SubDir_background,RootFile_background,Ext_background,'_1',j1_series_Civ1(ifield));
    406             elseif isfield(par_civ1,'NbSlice')
     400            elseif isfield(par_civ1,'NbSlice')&& ~isequal(par_civ1.NbSlice,1)
    407401                i1_background=mod(i1-1,par_civ1.NbSlice)+1;
    408402                backgroundname=fullfile_uvmat(RootPath_background,SubDir_background,RootFile_background,Ext_background,'_1',i1_background);
     
    418412                if ~isempty(regexp(backgroundname,'(^http://)|(^https://)', 'once'))|| exist(backgroundname,'file')
    419413                    try
    420                         par_civ1.Background=imread(backgroundname);%update the background, an store it for future use
     414                        par_civ1.Background=uint16(imread(backgroundname));%update the background, an store it for future use
    421415                    catch ME
    422416                        if ~isempty(ME.message)
     
    432426                backgroundoldname=backgroundname;
    433427            end
    434             par_civ1.ImageA=par_civ1.ImageA-par_civ1.Background;
    435             par_civ1.ImageB=par_civ1.ImageB-par_civ1.Background;
     428            par_civ1.ImageA=uint16(par_civ1.ImageA)-par_civ1.Background;
     429            par_civ1.ImageB=uint16(par_civ1.ImageB)-par_civ1.Background;
    436430        end
    437431       
     
    496490            if ~isempty(i2_series_Civ1)&& ~isequal(i1_series_Civ1,i2_series_Civ1)% case of volume,masks act on different j levels
    497491                maskname=fullfile_uvmat(RootPath_mask,SubDir_mask,RootFile_mask,Ext_mask,'_1',j1);
    498             elseif isfield(par_civ1,'NbSlice')
     492            elseif isfield(par_civ1,'NbSlice')&& ~isequal(par_civ1.NbSlice,1)
    499493                i1_mask=mod(i1-1,par_civ1.NbSlice)+1;
    500494                maskname=fullfile_uvmat(RootPath_mask,SubDir_mask,RootFile_mask,Ext_mask,'_1',i1_mask);
     
    638632        if strcmp(ImageName_A_Civ2,ImageName_A) && isequal(FrameIndex_A,FrameIndex_A_2)
    639633            par_civ2.ImageA=par_civ1.ImageA;
     634            CheckDuplicate_1to2A=true;
    640635        else
    641636            [par_civ2.ImageA,VideoObject_A] = read_image(ImageName_A_Civ2,FileType_A,VideoObject_A,FrameIndex_A_2);
     637            CheckDuplicate_1to2A=false;
    642638        end
    643639        if CheckRelabel
     
    650646        if strcmp(ImageName_B_Civ2,ImageName_B) && isequal(FrameIndex_B_2,FrameIndex_B)
    651647            par_civ2.ImageB=par_civ1.ImageB;
     648            CheckDuplicate_1to2B=true;
    652649        else
    653650            [par_civ2.ImageB,VideoObject_B] = read_image(ImageName_B_Civ2,FileType_B,VideoObject_B,FrameIndex_B_2);
     651             CheckDuplicate_1to2B=false;
    654652        end
    655653        %  [FileInfo_A,VideoObject_A]=get_file_info(ImageName_A_Civ2);
     
    673671        end
    674672       
    675         %                 %% user defined image transform
    676         %         if ~isempty(transform_fct)
    677         %                par_civ2 =transform_fct(par_civ2,Param);
    678         %         end
     673        %% case of background image to subtract, if images civ2 different from civ1
     674        if (~CheckDuplicate_1to2A || ~CheckDuplicate_1to2B) && par_civ2.CheckBackground &&~isempty(par_civ2.Background)
     675            [RootPath_background,SubDir_background,RootFile_background,~,~,~,~,Ext_background]=fileparts_uvmat(Param.ActionInput.Civ2.Background);
     676            j1=1;
     677            if ~isempty(j1_series_Civ2)
     678                j1=j1_series_Civ2(ifield);
     679            end
     680            if ~isempty(i2_series_Civ2)% case of volume,backgrounds act on different j levels
     681                backgroundname=fullfile_uvmat(RootPath_background,SubDir_background,RootFile_background,Ext_background,'_1',j1);
     682            elseif isfield(par_civ2,'NbSlice') && ~isequal(par_civ2.NbSlice,1)
     683                i1_background=mod(i1-1,par_civ2.NbSlice)+1;
     684                backgroundname=fullfile_uvmat(RootPath_background,SubDir_background,RootFile_background,Ext_background,'_1',i1_background);
     685                if strcmp(Param.ActionInput.PairIndices.ListPairMode,'series(Di)')% case of volume, background index refers to j index
     686                    par_civ2.NbSlice_j=par_civ2.NbSlice;
     687                end
     688            else
     689                backgroundname=Param.ActionInput.Civ2.Background;
     690            end
     691            if strcmp(backgroundoldname,backgroundname)% background exist, not already read in civ2
     692                par_civ2.Background=background; %use background already opened
     693            else
     694                if ~isempty(regexp(backgroundname,'(^http://)|(^https://)', 'once'))|| exist(backgroundname,'file')
     695                    try
     696                        par_civ2.Background=uint16(imread(backgroundname));%update the background, an store it for future use
     697                    catch ME
     698                        if ~isempty(ME.message)
     699                            errormsg=['error reading input image: ' ME.message];
     700                            disp_uvmat('ERROR',errormsg,checkrun)
     701                            return
     702                        end
     703                    end
     704                else
     705                    par_civ2.Background=[];
     706                end
     707                background=par_civ2.Background;
     708                backgroundoldname=backgroundname;
     709            end
     710            if ~CheckDuplicate_1to2A
     711            par_civ2.ImageA=uint16(par_civ2.ImageA)-par_civ2.Background;
     712            end
     713            if ~CheckDuplicate_1to2B
     714            par_civ2.ImageB=uint16(par_civ2.ImageB)-par_civ2.Background;
     715            end
     716        end
     717   
    679718        %% case of image luminosity rescaling
    680         if par_civ2.CheckRescale &&~isempty(par_civ2.Maxtanh)
    681             par_civ2.ImageA =par_civ2.Maxtanh*tanh(double(par_civ2.ImageA)/par_civ2.Maxtanh);
    682             par_civ2.ImageB=par_civ2.Maxtanh*tanh(double(par_civ2.ImageB)/par_civ2.Maxtanh);
     719        if  par_civ2.CheckRescale && ~isempty(par_civ2.Maxtanh)
     720            if ~CheckDuplicate_1to2A %if the image A is different from civ1
     721                par_civ2.ImageA =par_civ2.Maxtanh*tanh(double(par_civ2.ImageA)/par_civ2.Maxtanh);
     722            end
     723            if ~CheckDuplicate_1to2B % if the image B is different from civ1
     724                par_civ2.ImageB=par_civ2.Maxtanh*tanh(double(par_civ2.ImageB)/par_civ2.Maxtanh);
     725            end
    683726        end
    684727       
     
    761804                end
    762805                maskname=fullfile_uvmat(RootPath_mask,SubDir_mask,RootFile_mask,Ext_mask,'_1',j1);
    763             elseif isfield(par_civ2,'NbSlice')
     806            elseif isfield(par_civ2,'NbSlice')&& ~isequal(par_civ2.NbSlice,1)
    764807                i1=i1_series_Civ2(ifield);
    765808                i1_mask=mod(i1-1,par_civ2.NbSlice)+1;
     
    794837        end
    795838       
    796         % case of background image to subtract
    797         if par_civ2.CheckBackground &&~isempty(par_civ2.Background)
    798             [RootPath_background,SubDir_background,RootFile_background,~,~,~,~,Ext_background]=fileparts_uvmat(Param.ActionInput.Civ1.Background);
    799             j1=1;
    800             if ~isempty(j1_series_Civ1)
    801                 j1=j1_series_Civ1(ifield);
    802             end
    803             if ~isempty(i2_series_Civ1)% case of volume,backgrounds act on different j levels
    804                 backgroundname=fullfile_uvmat(RootPath_background,SubDir_background,RootFile_background,Ext_background,'_1',j1);
    805             elseif isfield(par_civ2,'NbSlice')
    806                 i1_background=mod(i1-1,par_civ2.NbSlice)+1;
    807                 backgroundname=fullfile_uvmat(RootPath_background,SubDir_background,RootFile_background,Ext_background,'_1',i1_background);
    808                 if strcmp(Param.ActionInput.PairIndices.ListPairMode,'series(Di)')% case of volume, background index refers to j index
    809                     par_civ2.NbSlice_j=par_civ2.NbSlice;
    810                 end
    811             else
    812                 backgroundname=Param.ActionInput.Civ1.Background;
    813             end
    814             if strcmp(backgroundoldname,backgroundname)% background exist, not already read in civ2
    815                 par_civ2.Background=background; %use background already opened
    816             else
    817                 if ~isempty(regexp(backgroundname,'(^http://)|(^https://)', 'once'))|| exist(backgroundname,'file')
    818                     try
    819                         par_civ2.Background=imread(backgroundname);%update the background, an store it for future use
    820                     catch ME
    821                         if ~isempty(ME.message)
    822                             errormsg=['error reading input image: ' ME.message];
    823                             disp_uvmat('ERROR',errormsg,checkrun)
    824                             return
    825                         end
    826                     end
    827                 else
    828                     par_civ2.Background=[];
    829                 end
    830                 background=par_civ2.Background;
    831                 backgroundoldname=backgroundname;
    832             end
    833             par_civ2.ImageA=par_civ2.ImageA-par_civ2.Background;
    834             par_civ2.ImageB=par_civ2.ImageB-par_civ2.Background;
    835         end
    836        
     839        %% get civ2 correlation parameters
    837840        if strcmp(Param.ActionInput.ListCompareMode,'displacement')
    838841            Civ1_Dt=1;
     
    852855        end
    853856       
    854         % calculate velocity data (y and v in image indices, reverse to y component)
    855        
     857        % calculate velocity data     
    856858        [Civ_X,Civ_Y,Civ_U,Civ_V,Civ_C,Civ_FF,~, errormsg] = civ (par_civ2);
    857859        Civ_X_shifted=Civ_X-0.5+Civ_U/2;% get the exact positions
     
    878880        Data.ListGlobalAttribute=[Data.ListGlobalAttribute Civ2_param];
    879881       
    880         %        nbvar=numel(Data.ListVarName);
    881         % define the Civ2 variable (if Civ2 data are not replaced from previous calculation)
    882         %         if isempty(find(strcmp('Civ2_X',Data.ListVarName),1))
    883         %             Data.ListVarName=[Data.ListVarName {'Civ2_X','Civ2_Y','Civ2_U','Civ2_V','Civ2_C','Civ2_FF'}];%  cell array containing the names of the fields to record
    884         %             Data.VarDimName=[Data.VarDimName {'nb_vec_2','nb_vec_2','nb_vec_2','nb_vec_2','nb_vec_2','nb_vec_2'}];
    885         %             Data.VarAttribute{nbvar+1}.Role='coord_x';
    886         %             Data.VarAttribute{nbvar+2}.Role='coord_y';
    887         %             Data.VarAttribute{nbvar+3}.Role='vector_x';
    888         %             Data.VarAttribute{nbvar+4}.Role='vector_y';
    889         %             Data.VarAttribute{nbvar+5}.Role='ancillary';
    890         %             Data.VarAttribute{nbvar+6}.Role='errorflag';
    891         %         end
    892882        disp('civ2 performed')
    893883        time_civ2=toc(tstart_civ2);
     
    930920        end
    931921        Data.ListGlobalAttribute=[Data.ListGlobalAttribute Patch2_param];
    932        
    933         %  nbvar=length(Data.ListVarName);
    934         %         Data.ListVarName=[Data.ListVarName {'Civ2_U_smooth','Civ2_V_smooth','Civ2_SubRange','Civ2_NbCentres','Civ2_Coord_tps','Civ2_U_tps','Civ2_V_tps'}];
    935         %         Data.VarDimName=[Data.VarDimName {'nb_vec_2','nb_vec_2',{'nb_coord','nb_bounds','nb_subdomain_2'},{'nb_subdomain_2'},...
    936         %             {'nb_tps_2','nb_coord','nb_subdomain_2'},{'nb_tps_2','nb_subdomain_2'},{'nb_tps_2','nb_subdomain_2'}}];
    937        
    938         %         Data.VarAttribute{nbvar+1}.Role='vector_x';
    939         %         Data.VarAttribute{nbvar+2}.Role='vector_y';
    940         %         Data.VarAttribute{nbvar+5}.Role='coord_tps';
    941         %         Data.VarAttribute{nbvar+6}.Role='vector_x';
    942         %         Data.VarAttribute{nbvar+7}.Role='vector_y';
    943922       
    944923        if isempty(Civ_FF)
  • trunk/src/uvmat.m

    r1199 r1200  
    192192LowY=round(ScreenSize(4)/2-Height/2); % put at the middle height on the screen
    193193set(hObject,'Position',[LeftX LowY Width Height])
    194 UvData.PosColorbar=[0.80 0.02 0.018 0.445];
     194%UvData.PosColorbar=[0.80 0.02 0.018 0.445];
    195195AxeData.LimEditBox=1; %initialise AxeData
    196196set(handles.PlotAxes,'UserData',AxeData)
     
    221221%% EXPORT menu
    222222export_menu={'as field in workspace';'in new figure';'on existing axis';'make movie';'more...'};
    223 %export_path=fullfile(path_uvmat,'export_fct');
    224223
    225224%% load the list of previously browsed files in menus Open, Open_1 and TransformName
     
    264263set(handles.TransformPath,'String','')
    265264set(handles.TransformPath,'UserData',[])
    266 export_menu=[export_menu;{'more...'}];%append the option more.. to the menu
     265%export_menu=[export_menu;{'more...'}];%append the option more.. to the menu
    267266
    268267%% case of an input argument for uvmat
     
    295294        UvData.Field.coord_x=[0.5 size(input,2)-0.5];
    296295        UvData.Field.coord_y=[size(input,1)-0.5 0.5];
    297         %testinputfield=1;
    298296    end
    299297else
    300298    %% check the path and date of modification of all functions in uvmat
    301299    path_to_uvmat=which ('uvmat');% check the path detected for source file uvmat
    302     [infomsg,date_str,svn_info]=check_files;%check the path of the functions called by uvmat.m
     300    [infomsg,date_str]=check_files;%check the path of the functions called by uvmat.m
    303301    date_str=['last modification: ' date_str];
    304302    if ishandle(handles.UVMAT_title)
     
    357355%------------------------------------------------------------------------
    358356set(handles.uvmat,'Units','pixels')
    359 size_fig=get(handles.uvmat,'Position');
    360 ColumnWidth=max(150,0.18*size_fig(3)); %width of the right side display column equal to 0.18 *uvmat_GUI, in the range between 150 px and 250 px
     357size_uvmat=get(handles.uvmat,'Position');
     358ColumnWidth=max(150,0.18*size_uvmat(3)); %width of the right side display column equal to 0.18 *uvmat_GUI, in the range between 150 px and 250 px
    361359ColumnWidth=min(ColumnWidth,250);
    362 
    363 %% position of panel InputFile
     360InputFilePanelHeight=80;
     361TextDisplayPanelHeight=100;
     362CheckTablePanelHeight=100;
     363CoordinatesPanelHeight=100;
     364ScalarPanelHeight=150;
     365Interval=2;
     366
     367%% reset position of panel InputFile
    364368set(handles.InputFile,'Units','pixels')
    365369%pos_InputFile=get(handles.InputFile,'Position')% [lower x lower y width height] for text_display
    366 pos_InputFile(1)=0;            % set frame InputFile to the left of uvmat GUI
    367 pos_InputFile(2)=size_fig(4)-60;             % set frame InputFile to the top of uvmat GUI
    368 pos_InputFile(3)=size_fig(3);     %width of the GUI uvmat
    369 pos_InputFile(4)=60; %set the height of the panel to 60 px
     370pos_InputFile(1)=Interval;            % set frame InputFile to the left of uvmat GUI
     371pos_InputFile(2)=size_uvmat(4)-InputFilePanelHeight-Interval;             % set frame InputFile to the top of uvmat GUI
     372pos_InputFile(3)=size_uvmat(3)-2*Interval;     %width of the GUI uvmat
     373pos_InputFile(4)=InputFilePanelHeight; %set the height of the panel
    370374set(handles.InputFile,'Position',pos_InputFile);% [lower x lower y width height]
    371375
     
    373377set(handles.text_display,'Units','pixels')
    374378set(handles.TableDisplay,'Units','pixels')
    375 pos_1=get(handles.text_display,'Position');% [lower x lower y width height] for text_display
    376 pos_1(3)=1.2*ColumnWidth;
    377 pos_1(1)=size_fig(3)-pos_1(3);             % set text display to the right of the fig
    378 pos_1(2)=size_fig(4)-pos_InputFile(4)-pos_1(4);             % set text display to the top of the fig
     379pos_1(1)=size_uvmat(3)-ColumnWidth-Interval;
     380pos_1(2)=pos_InputFile(2)-TextDisplayPanelHeight-Interval;             % set text display to the top of the fig
     381pos_1(3)=ColumnWidth;
     382pos_1(4)=TextDisplayPanelHeight;         
    379383set(handles.text_display,'Position',pos_1)
    380384set(handles.TableDisplay,'Position',[pos_1(1) 10 pos_1(3) 5*pos_1(4)])
    381 % reset position of CheckTable
     385
     386%% reset position of CheckTable
    382387set(handles.CheckTable,'Units','pixels')
    383 pos_CheckTable=get(handles.CheckTable,'Position');% [lower x lower y width height] for CheckHold
    384 pos_CheckTable(1)=pos_1(1)-pos_CheckTable(3);       % set 'CheckHold' to the right of the fig
    385 pos_CheckTable(2)=pos_InputFile(2)-pos_CheckTable(4);          % set 'CheckHold' to the lower edge of text display
     388pos_CheckTable(1)=size_uvmat(3)-ColumnWidth-Interval;       % set 'CheckHold' to the right of the fig
     389pos_CheckTable(2)=pos_InputFile(2)-CheckTablePanelHeight-Interval;          % set 'CheckHold' to the lower edge of text display
     390pos_CheckTable(3)=ColumnWidth;
     391pos_CheckTable(4)=CheckTablePanelHeight;
    386392set(handles.CheckTable,'Position',pos_CheckTable)
    387 
    388 %% reset position of CheckHold
    389 % pos_CheckHold=get(handles.CheckHold,'Position');% [lower x lower y width height] for CheckHold
    390 % pos_CheckHold(1)=size_fig(3)-pos_CheckHold(3);       % set 'CheckHold' to the right of the fig
    391 % pos_CheckHold(2)=pos_1(2)-pos_CheckHold(4);          % set 'CheckHold' to the lower edge of text display
    392 % set(handles.CheckHold,'Position',pos_CheckHold)
    393393
    394394%% reset position of Coordinates panel
    395395set(handles.Coordinates,'Units','pixels')
    396 %pos_2=get(handles.Coordinates,'Position')% [lower x lower y width height] for frame 'Coordinates'
    397 pos_2(1)=size_fig(3)-ColumnWidth;       % set 'Coordinates' to the right of the fig
    398 pos_2(2)=pos_1(2)-80;          % set 'Coordinates' to the lower edge of text display
     396pos_2(1)=size_uvmat(3)-ColumnWidth-Interval;       % set 'Coordinates' to the right of the fig
     397pos_2(2)=pos_1(2)-CoordinatesPanelHeight-Interval;          % set 'Coordinates' to the lower edge of text display
    399398pos_2(3)=ColumnWidth;
    400 pos_2(4)=80;%keep height to 80 px
     399pos_2(4)=CoordinatesPanelHeight;%keep height to 80 px
    401400set(handles.Coordinates,'Position',pos_2)
    402401
    403402%% reset position of Axes panel
    404403set(handles.Axes,'Units','pixels')
    405 %pos_3=get(handles.Axes,'Position')% [lower x lower y width height] for frame 'Coordinates'
    406 pos_3(1)=size_fig(3)-ColumnWidth;       % set 'Coordinates' to the right of the fig
    407 pos_3(2)=pos_2(2)-140;   
     404pos_3(1)=size_uvmat(3)-ColumnWidth-Interval;       % set 'Coordinates' to the right of the fig
     405pos_3(2)=pos_2(2)-140-Interval;   
    408406pos_3(3)=ColumnWidth;
    409407pos_3(4)=140;%keep height to 140 px
     
    412410%% reset position of  Scalar
    413411set(handles.Scalar,'Units','pixels')
    414 %pos_4=get(handles.Scalar,'Position') % [lower x lower y width height] for frame 'Scalar'
    415 pos_4(1)=size_fig(3)-ColumnWidth;         % set 'Scalar' to the right of the fig
     412pos_4(1)=size_uvmat(3)-ColumnWidth-Interval;         % set 'Scalar' to the right of the fig
    416413if strcmp(get(handles.Scalar,'Visible'),'on')
    417     pos_4(2)=pos_3(2)-140; % set 'Scalar' to the lower edge of frame 'Coordinates' if visible
    418 else
    419     pos_4(2)=pos_3(2);% set 'Scalar' to the lower edge of frame 'text display' if  unvisible
     414    pos_4(2)=pos_3(2)-ScalarPanelHeight-Interval; % set 'Scalar' to the lower edge of frame 'Coordinates' if visible
     415else
     416    pos_4(2)=pos_3(2)-Interval;% set 'Scalar' to the lower edge of frame 'text display' if  unvisible
    420417end
    421418pos_4(3)=ColumnWidth;
    422 pos_4(4)=140;
     419pos_4(4)=ScalarPanelHeight;
    423420set(handles.Scalar,'Position',pos_4)
    424421
    425422%% reset position of  Vectors
    426423set(handles.Vectors,'Units','pixels')
    427 %pos_5=get(handles.Vectors,'Position')
    428 pos_5(1)=size_fig(3)-ColumnWidth;
     424pos_5(1)=size_uvmat(3)-ColumnWidth-Interval;
    429425if strcmp(get(handles.Vectors,'visible'),'on')
    430     pos_5(2)=pos_4(2)-240;
    431 else
    432     pos_5(2)=pos_4(2);
     426    pos_5(2)=pos_4(2)-240-Interval;
     427else
     428    pos_5(2)=pos_4(2)-Interval;
    433429end
    434430pos_5(3)=ColumnWidth;
     
    437433
    438434%% reset position and scale of axis
    439 pos(1)=0.2*size_fig(3)+35;
     435pos(1)=0.2*size_uvmat(3)+35;
    440436pos(2)=50;
    441 pos(3)=0.77*size_fig(3)-1.2*ColumnWidth;
    442 pos(4)=size_fig(4)-100;
     437pos(3)=0.77*size_uvmat(3)-1.2*ColumnWidth;
     438pos(4)=pos_InputFile(2)-50-Interval;
    443439set(handles.PlotAxes,'Units','pixels')
    444440set(handles.PlotAxes,'Position',pos)
    445 set(handles.PlotAxes,'Units','normalized')
    446 
    447 
     441%set(handles.PlotAxes,'Units','normalized')
     442UvData=get(handles.uvmat,'UserData');
     443UvData.PosColorbar([1 3])=[pos(1)+pos(3)+10 10]/size_uvmat(3);
     444UvData.PosColorbar([2 4])=[pos(2)+pos(3)/4 pos(3)/2]/size_uvmat(4);
     445set(handles.uvmat,'UserData',UvData)
     446
     447%% reset position of Field Indices TODO
     448% set(handles.FieldIndices,'Units','pixels')
     449% pos_4(1)=size_uvmat(3)-ColumnWidth;         % set 'Scalar' to the right of the fig
     450% if strcmp(get(handles.Scalar,'Visible'),'on')
     451%     pos_4(2)=pos_3(2)-ScalarPanelHeight-Interval; % set 'Scalar' to the lower edge of frame 'Coordinates' if visible
     452% else
     453%     pos_4(2)=pos_3(2)-Interval;% set 'Scalar' to the lower edge of frame 'text display' if  unvisible
     454% end
     455% pos_4(3)=ColumnWidth;
     456% pos_4(4)=ScalarPanelHeight;
     457% set(handles.Scalar,'Position',pos_4)
    448458
    449459%------------------------------------------------------------------------
     
    21192129function MenuHelp_Callback(hObject, eventdata, handles)
    21202130% --------------------------------------------------------------------
    2121 web('https://gricad-gitlab.univ-grenoble-alpes.fr/legi/soft/uvmat-doc/-/blob/master/help/README.md')
     2131web('https://legi.gricad-pages.univ-grenoble-alpes.fr/soft/uvmat-doc/help')
    21222132
    21232133
     
    30153025    end
    30163026    FileInfo=get_file_info(fileinput);
    3017     if isfield(FileInfo,'MaskFile')%&& exist(FileInfo.MaskFile,'file')
     3027    if isfield(FileInfo,'MaskFile') % if a Mask has been documented in the input file (civ data)
    30183028        Mask.MaskFile=FileInfo.MaskFile;
    30193029        if isfield(FileInfo,'MaskNbSlice')
    30203030            Mask.MaskNbSlice=FileInfo.MaskNbSlice;
    30213031        end
    3022     else
     3032    else % look for an apporpriate mask with the browser
    30233033        filemask= uigetfile_uvmat('pick a mask image file:',fileinput,'image');
    30243034        if ~isempty(filemask)
    30253035            [FilePath,FileName,FileExt]=fileparts(filemask);
    3026             [RootPath,SubDir,RootFile,i1_series,i2,j1,j2,NomType]=find_file_series(FilePath,[FileName FileExt]);
     3036            [RootPath,SubDir,RootFile,i1_series,~,~,~,NomType]=find_file_series(FilePath,[FileName FileExt]);
    30273037            if strcmp(NomType,'_1')
    30283038                Mask.MaskFile=fullfile(RootPath,SubDir,RootFile);
    30293039                Mask.MaskExt=FileExt;
    30303040                Mask.MaskNbSlice=i1_series(1,2,end);
    3031             elseif ~strcmp(NomType,'*')
     3041            elseif strcmp(NomType,'*')
     3042                Mask.MaskFile=fullfile(RootPath,SubDir,RootFile);
     3043                Mask.MaskExt=FileExt;
     3044            else
    30323045                msgbox_uvmat('ERROR','multilevel masks must be labeled with a single index as _1,_2,...');
    30333046                set(handles.CheckMask,'Value',0)
     
    30363049        end
    30373050    end
    3038     %         i1=str2double(get(handles.num_i1,'String'));
    3039     %         filemask=FileInfo.MaskFile;
    3040     %         if isfield(FileInfo,'MaskNbSlice')
    3041     %         i1=str2double(get(handles.num_i1,'String'));
    3042     %         MaskIndex=mod(i1,FileInfo.MaskNbSlice)
    3043     %         filemask=[filemask '_' num2str(MaskIndex) FileInfo.MaskExt]
    3044     % %     else
    3045     % %         filemask= uigetfile_uvmat('pick a mask image file:',RootPath,'image');
    3046     %     end
    3047     %     if ~isempty(filemask)
    3048     %         [MaskPath,FileName,FileExt]=fileparts(filemask);
    3049     %         Mask.File=filemask;
    3050     %         [~,~,~,i1_series,~,~,~,NomType]=find_file_series(MaskPath,[FileName FileExt]);
    3051     %         Mask.NbSlice=[];%default
    3052     %         Mask.VolumeScan=0;% TO UPDATE ***
    3053     %         if strcmp(NomType,'_1')
    3054     %             Mask.NbSlice=i1_series(1,2,end);
    3055     %             set(handles.num_NbSlice,'String',num2str(Mask.NbSlice))
    3056     %         elseif ~strcmp(NomType,'*')
    3057     %             msgbox_uvmat('ERROR','multilevel masks must be labeled with a single index as _1,_2,...');
    3058     %             return
    3059     %         end
    3060     %set(hObject,'UserData',filemask);%store for future use
    30613051    set(handles.CheckMask,'UserData',Mask);
    30623052    errormsg=update_mask(handles);
     
    30833073%------------------------------------------------------------------------
    30843074errormsg=[];%default
    3085 MaskName='';
     3075%MaskName='';
    30863076
    30873077%% get the current mask name recorded in CheckMask/UserData, possibly indexed with file index
     
    30893079if isfield(MaskInfo,'MaskFile')
    30903080    if isfield(MaskInfo,'MaskNbSlice')&& ~isempty(MaskInfo.MaskNbSlice)
    3091         if isfield(MaskInfo,'VolumeScan') &&  MaskInfo.VolumeScan
     3081        if isfield(MaskInfo,'VolumeScan') &&  MaskInfo.VolumeScanTransformMenu
    30923082            MaskIndex_i=str2double(get(handles.num_j1,'String'));
    30933083        else
     
    30973087    else
    30983088        MaskIndex_i=1;
    3099         MaskName=MaskInfo.MaskFile;
     3089    MaskName=[MaskInfo.MaskFile MaskInfo.MaskExt];
    31003090    end
    31013091   
    31023092    %% update mask image if the mask is new
    31033093    UvData=get(handles.uvmat,'UserData');
    3104      TransformMenu=get(handles.TransformName,'String')
     3094     TransformMenu=get(handles.TransformName,'String');
    31053095      TransformName=  TransformMenu{get(handles.TransformName,'Value')};
    31063096    if ~ (isfield(UvData,'MaskName') && strcmp(UvData.MaskName,MaskName)&& isfield(UvData,'TransformName')&& strcmp(UvData.TransformName,TransformName))%check if the mask is new
     
    31083098        UvData.TransformName=TransformName; %update the recorded name on UvData
    31093099        set(handles.uvmat,'UserData',UvData);
    3110         if exist(MaskName,'file')~=2
     3100        if exist(MaskName,'file')~=2 % case file MaskName does not exist
    31113101            if isfield(MaskInfo,'maskhandle')&& ishandle(Mask.maskhandle)
    31123102                delete(MaskInfo.maskhandle)
     3103                set(handles.CheckMask,'Value',0)
    31133104            end
    31143105        else
     
    33223313    set(handles.CheckFixPair,'Value',0)
    33233314end
    3324 %CheckFixPair=get(handles.CheckFixPair,'Value')||(isempty(num_i2)&& isempty(num_j2));
    33253315
    33263316% the pair num_i1-num_i2 or num_j1-num_j2 is imposed (check box CheckFixPair selected)
     
    34273417            ref_j_1=ref_j;
    34283418        end
    3429         if numel(UvData.i1_series)==1
     3419        if isscalar(UvData.i1_series)
    34303420            UvData.i1_series{2}=UvData.i1_series{1};
    34313421            UvData.j1_series{2}=UvData.j1_series{1};
     
    35033493        NbField_j_cell=get(handles.MaxIndex_j,'String');
    35043494        NbField_j=str2double(NbField_j_cell{1});
    3505         [RootFile,FrameIndex]=index2filename(UvData.XmlData{1}.FileSeries,i1,j1,NbField_j);
     3495        RootFile=index2filename(UvData.XmlData{1}.FileSeries,i1,j1,NbField_j);
    35063496        [~,RootFile]=fileparts(RootFile);%suppress the file extension
    35073497        set(handles.RootFile,'String',RootFile)
     
    41334123    check_x_name=find(strcmp(coord_x_name,UvData.Field.ListVarName));
    41344124    UvData.Field.VarAttribute{check_x_name}.Role='coord_x';
    4135     [PlotType,PlotParamOut,haxes]=plot_field(UvData.Field,handles.PlotAxes,read_GUI(handles.uvmat));
     4125    [~,PlotParamOut]=plot_field(UvData.Field,handles.PlotAxes,read_GUI(handles.uvmat));
    41364126    UvData.PlotAxes=UvData.Field; %store data for further plot modifications
    41374127    errormsg=fill_GUI(PlotParamOut,handles.uvmat);
     
    43124302            else
    43134303                [PlotType,PlotParamOut]=plot_field(ObjectData,haxes(imap),PlotParam{imap});
    4314                 if ~isempty(regexp(PlotType,'^error'))%exit in case of plotting error
    4315                     if ~isempty(regexp(PlotType,'attempt to plot two vector fields'))
     4304                if ~isempty(regexp(PlotType,'^error', 'once'))%exit in case of plotting error
     4305                    if ~isempty(regexp(PlotType,'attempt to plot two vector fields', 'once'))
    43164306                        set(handles.CheckEditObject,'Value',1)
    43174307                        CheckEditObject_Callback([], [], handles)% propose to edit the main projection plane
     
    56545644%-------------------------------------------------------------------
    56555645function num_Opacity_Callback(hObject, eventdata, handles)
     5646%-------------------------------------------------------------------
    56565647update_plot(handles);
    5657 %-------------------------------------------------------------------
    56585648
    56595649%-------------------------------------------------------------------
     
    57095699%------------------------------------------------------------------------
    57105700% --- Executes on selection change in CheckDecimate4 (nb_vec/4).
    5711 %------------------------------------------------------------------------
    57125701function CheckDecimate4_Callback(hObject, eventdata, handles)
    5713 
     5702%------------------------------------------------------------------------
    57145703if isequal(get(handles.CheckDecimate4,'Value'),1)
    57155704    set(handles.CheckDecimate16,'Value',0)
Note: See TracChangeset for help on using the changeset viewer.