Changeset 1200 for trunk/src/uvmat.m


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

bug repaired for civ image rescale

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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.