Changeset 177 for trunk


Ignore:
Timestamp:
Jan 7, 2011, 1:53:05 AM (14 years ago)
Author:
sommeria
Message:

bug with mouse object editing resolved. Display feature 'satus' for PIV task advancement introduced. Various bug repair and cleaning

Location:
trunk/src
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/civ.m

    r174 r177  
    2222function varargout = civ(varargin)
    2323
    24 % Last Modified by GUIDE v2.5 01-Dec-2010 23:19:15
     24% Last Modified by GUIDE v2.5 05-Jan-2011 16:19:30
    2525% Begin initialization code - DO NOT EDIT
    2626gui_Singleton = 1;
     
    335335browse.num_j2=num_j2;
    336336if length(ext)>1 && (~isempty(imformats(ext(2:end)))||strcmpi(ext,'.avi'));%if an image file has been opened by uvmat
    337 %     set(handles.ImaExt,'String',ext)
    338337    browse.nom_type_ima=nom_type;
    339338    browse.ext_ima=ext;
     339    set(handles.ImaExt,'String',ext)
    340340end
    341341set(handles.ImaDoc,'String',ext);
     
    593593        end
    594594    end
    595 %     if ~isempty(ext_ima_read) && ~isempty(nom_type_read)
    596 % %         if isempty(ext_ima)
    597 % %             ext_ima=ext_ima_read;% define image extension from the xml file if an image has not been opened previously
    598 % %         else   %keep the image extension
    599 % %             if  ~strcmp(ext_ima_read,ext_ima)
    600 % %                 msgbox_uvmat('WARNING',['FirtsImage extension ' ext_ima_read ' announced in the xml file inconsistent with the selected image'])
    601 % %             end
    602 % %         end
    603 %         nom_type_ima=nom_type_read;
    604 %     end
    605595elseif strcmp(ext_imadoc,'.civ')% case of .civ image documentation file
    606596    [error,time,TimeUnit,mode,npx,npy]=read_imatext([filebase '.civ']);
     
    612602    nom_type_ima='*';
    613603    ext_ima=ext_imadoc;
     604    set(handles.mode,'Value',1);
    614605    set(handles.mode,'String',{'series(Di)'})
    615606    dt=0.04;%default
     
    620611    end
    621612    time=(dt*(0:nbfield-1))';%list of image times
    622     %set(handles.dt,'String',num2str(dt*1000));%store the time interval between successive images
    623613end
    624614if isempty(time)
     
    698688        field_i=browse.num_i1;
    699689        field_j=browse.num_j2;
     690        imagename=name_generator(filebase,field_i,field_j,ext_search,nom_type_search);
    700691        imagename_plus='';
    701692        jdetect=1;
     
    716707    time=(0:nbfield-1)';% time=file index -1  by default
    717708    if numel(regexp(nom_type_search,'\D'))>=1%two indices i and j
    718 %     switch nom_type_search 
    719 %         case {'_i_j','%01dA','%02dA','%03dA','%04dA'}
    720         % time=[0:nb_field-1]'*ones(1,nb_field_j);% time=file index -1  by default
    721709        [x,y]=meshgrid(0:nbfield2-1,0:nbfield-1);
    722710        time=x+y;
    723 %         time=[0:nb_field-1]'*[0:nb_field_j-1];% time=file index -1  by default
    724     end
    725 %     set(handles.mode,'String',{'series(Di)'})
     711    end
    726712end
    727713
     
    750736
    751737%%%%%%%%%%%  set the menus of image pairs and default selection for civ   %%%%%%%%%%%%%%%%%%%
    752 test_ima_i=numel(nom_type_ima)>1 && isempty(regexp(nom_type_ima(2:end),'\D'));%images with single indexing
     738test_ima_i=numel(nom_type_ima)>1 && isempty(regexp(nom_type_ima(2:end),'\D','once'));%images with single indexing
    753739if test_ima_i || isequal(nom_type_nc,'_i1-i2')||~(exist('nbfield2','var')&&(nbfield2~=1))
    754     set(handles.mode,'String',{'series(Di)'})
    755740    set(handles.mode,'Value',1)
     741    set(handles.mode,'String',{'series(Di)'})   
    756742elseif (nbfield==1)% simple series in j
     743    set(handles.mode,'Value',1)
    757744    set(handles.mode,'String',{'series(Dj)'})
    758     set(handles.mode,'Value',1)
    759745else
    760746    set(handles.mode,'String',{'pair j1-j2';'series(Dj)';'series(Di)'})%multiple choice
     
    788774mode_Callback(hObject, eventdata, handles)
    789775
    790 %%%%%% initialize waitbars and RUN button
     776%% desable status and RUN button
    791777% set(handles.waitbar_1,'Position',[0.946 0.876 0.03 0.001])
    792778% set(handles.waitbar_patch1,'Position',[0.946 0.439 0.03 0.001])
     
    797783set(handles.BATCH,'Enable','On')
    798784set(handles.BATCH,'BackgroundColor',[1 0 0])
    799 
    800 %%%%% store the root input filename for future opening
     785set(handles.status,'Value',0);%suppress status display
     786status_Callback(hObject, eventdata, handles)
     787
     788%% store the root input filename for future opening
    801789dir_perso=prefdir;
    802790profil_perso=fullfile(prefdir,'uvmat_perso.mat');
     
    814802    end
    815803end
    816 % save(profil_perso, 'filebase'); %store the root name for future opening of uvmat
    817 set(gcf,'Pointer','arrow')
    818804
    819805%------------------------------------------------------------------------
     
    15651551end
    15661552
     1553%------------------------------------------------------------------------
     1554% --- Executes on button press in RUN: processing on local computer
    15671555function RUN_Callback(hObject, eventdata, handles)
    15681556%------------------------------------------------------------------------
    1569 % global civ1_exe civ2_exe patch_exe patch_new_exe sge
    15701557set(handles.RUN, 'Enable','Off')
    15711558set(handles.RUN,'BackgroundColor',[0.831 0.816 0.784])
     
    15751562set(handles.RUN,'BackgroundColor',[1 0 0])
    15761563
     1564% start status callback to visualise results
     1565set(handles.status,'Value',1);%suppress status display
     1566status_Callback(hObject, eventdata, handles)
     1567
    15771568%------------------------------------------------------------------------
    15781569% --- Executes on button press in BATCH: remote processing
    15791570function BATCH_Callback(hObject, eventdata, handles)
    1580 %% -----------------------------------------------------------------------
    1581 %global civ1_exe civ2_exe patch_exe patch_new_exe fix_exe todo_path sge Civ_exe % probabely to remove
     1571% -----------------------------------------------------------------------
    15821572set(handles.BATCH, 'Enable','Off')
    15831573set(handles.BATCH,'BackgroundColor',[0.831 0.816 0.784])
     
    15871577set(handles.BATCH,'BackgroundColor',[1 0 0])
    15881578
     1579% start status callback to visualise results
     1580set(handles.status,'Value',1);%suppress status display
     1581status_Callback(hObject, eventdata, handles)
    15891582%------------------------------------------------------------------------
    15901583% --- Lauch command called by RUN and BATCH: remote processing
     
    16131606end
    16141607
    1615 %check mask if selecetd
     1608%% check mask if selecetd
    16161609if isequal(get(handles.get_mask_civ1,'Value'),1)
    16171610    maskname=get(handles.mask_civ1,'String');
     
    16391632end
    16401633
    1641 %% initialize the waitbars: TO suppress, waitbar not used
    1642 % set(handles.waitbar_1,'Position',[0.946 0.876 0.03 0.001])
    1643 % set(handles.waitbar_patch1,'Position',[0.946 0.439 0.03 0.001])
    1644 % set(handles.waitbar_civ2,'Position',[0.946 0.219 0.03 0.001])
    1645 % set(handles.waitbar_patch2,'Position',[0.946 0.0 0.03 0.001])
    1646 % drawnow
     1634%% reinitialise status callback
     1635set(handles.status,'Value',0);%suppress status display
     1636status_Callback(hObject, eventdata, handles)
    16471637
    16481638%% set the list of files and check them
     
    16511641[filecell,num1_civ1,num2_civ1,num_a_civ1,num_b_civ1,num1_civ2,num2_civ2,num_a_civ2,num_b_civ2,nom_type_nc]=...
    16521642    set_civ_filenames(handles,box_test);
     1643set(handles.civ,'UserData',filecell);%store for futur use of status callback
    16531644if isempty(filecell)% (error message displayed in fct set_civ_filenames)
    16541645    return
     
    18791870        %filename_cur=filecell.nc.civ1{ifile,j};%output netcdf file
    18801871        [Rootbat,Filebat]=fileparts(filecell.nc.civ1{ifile,j});%output netcdf file (without extention)
     1872        flname=fullfile(Rootbat,Filebat);
    18811873        %filename_cmx(end-1:end+6)='civ1.cmx';%name of cmx file
    18821874        if batch
     
    18841876            filename_bat=fullfile(Rootbat,['job_' Filebat]);
    18851877         else
    1886             filename_bat=fullfile(Rootbat,Filebat);
     1878            filename_bat=flname;
    18871879        end
    18881880        filename_bat=[filename_bat '.bat'];
     
    18921884            par_civ1.filename_ima_a=filecell.ima1.civ1{ifile,j};
    18931885            par_civ1.filename_ima_b=filecell.ima2.civ1{ifile,j};
    1894             namelog=[fullfile(Rootbat,Filebat) '.civ1.log'];
     1886            %namelog=[fullfile(Rootbat,Filebat) '.civ1.log'];
    18951887            par_civ1.Dt=num2str(time(num2_civ1(ifile),num_b_civ1(j))-time(num1_civ1(ifile),num_a_civ1(j)));
    18961888            par_civ1.T0=num2str((time(num2_civ1(ifile),num_b_civ1(j))+time(num1_civ1(ifile),num_a_civ1(j)))/2);
     
    20652057            %par_civ2.filename_ima_b([end-3:end])=[];%remove .png extension
    20662058            [Rootbat,Filebat]=fileparts(filecell.nc.civ2{ifile,j});%output netcdf file (without extention)
    2067             namelog=[fullfile(Rootbat,Filebat) '.civ2.log'];
     2059            %namelog=[fullfile(Rootbat,Filebat) '.civ2.log'];
    20682060            par_civ2.Dt=num2str(time(num2_civ2(ifile),num_b_civ2(j))-time(num1_civ2(ifile),num_a_civ2(j)));
    20692061            par_civ2.T0=num2str((time(num2_civ1(ifile),num_b_civ2(j))+time(num1_civ2(ifile),num_a_civ2(j)))/2);
     
    21192111            %endTESTgrid
    21202112            i_cmd=i_cmd+1;
    2121             cmd_CIV2=CIV2_CMD(fullfile(Rootbat,Filebat),[],par_civ2,sparam);%creates the cmx file [fullfile(Rootbat,Filebat) '.civ2.cmx]
     2113            flname=fullfile(Rootbat,Filebat);
     2114            cmd_CIV2=CIV2_CMD(flname,[],par_civ2,sparam);%creates the cmx file [fullfile(Rootbat,Filebat) '.civ2.cmx]
    21222115            if isequal(civAll,0)
    2123                 flname=fullfile(Rootbat,Filebat);
    21242116                if(isunix)
    21252117                     cmd=[cmd 'cp -f ' flname '.civ2.cmx ' flname '.cmx\n' cmd_CIV2 '\n'];
     
    22532245                    pvalue=num2str((1-ind_answer)*500);
    22542246                    %namelog=[filename_bat '.patch.log'];
    2255                     display(['!qsub -p ' pvalue ' -q civ.q -e ' filename_cmx(1:end-4) '.errors -o ' filename_cmx(1:end-4) '.log' ' ' filename_bat]);
    2256                     eval(  ['!qsub -p ' pvalue ' -q civ.q -e ' filename_cmx(1:end-4) '.errors -o ' filename_cmx(1:end-4) '.log' ' ' filename_bat]);
     2247                    display(['!qsub -p ' pvalue ' -q civ.q -e ' flname '.errors -o ' flname '.log' ' ' filename_bat]);
     2248                    eval(  ['!qsub -p ' pvalue ' -q civ.q -e ' flname '.errors -o ' flname '.log' ' ' filename_bat]);
    22572249            end
    22582250        else
     
    23052297end
    23062298saveas(gcbf,namefigfull);%save the interface with name namefigfull (A CHANGER EN FICHIER  .xml)
     2299
    23072300
    23082301
     
    44174410    set(handles.RootName_1,'String',[]);
    44184411    mode_store=get(handles.compare,'UserData');
     4412    set(handles.mode,'Value',1)
    44194413    set(handles.mode,'String',mode_store)
    44204414    set(handles.test_stereo1,'Value',0)
     
    46034597end
    46044598
    4605 
    4606 
    4607 
    4608 
    4609 
     4599%-------------------------------------------------------------------
     4600% --- Executes on button press in status.
     4601function status_Callback(hObject, eventdata, handles)
     4602%-------------------------------------------------------------------
     4603val=get(handles.status,'Value');
     4604if val==0
     4605    hfig=findobj(allchild(0),'name','civ_status');
     4606    if ~isempty(hfig)
     4607        delete(hfig)
     4608    end
     4609    return
     4610end
     4611listtype={'civ1','fix1','patch1','civ2','fix2','patch2'};
     4612box_test(1)=get(handles.CIV1,'Value');
     4613box_test(2)=get(handles.FIX1,'Value');
     4614box_test(3)=get(handles.PATCH1,'Value');
     4615box_test(4)=get(handles.CIV2,'Value');
     4616box_test(5)=get(handles.FIX2,'Value');
     4617box_test(6)=get(handles.PATCH2,'Value');
     4618option=listtype{max(box_test(find(box_test)))};
     4619filecell=get(handles.civ,'UserData');
     4620if ~isfield(filecell,'nc')
     4621    filecell=set_civ_filenames(handles,box_test);%determine the list of output files expected from the GUI status
     4622end
     4623
     4624if ~isequal(box_test(4:6),[0 0 0])
     4625    civ_files=filecell.nc.civ2;
     4626else
     4627    civ_files=filecell.nc.civ1;
     4628end
     4629[root,filename,ext]=fileparts(civ_files{1});
     4630[rootroot,subdir,extdir]=fileparts(root);
     4631hfig=findobj(allchild(0),'name','civ_status');
     4632if isempty(hfig)
     4633    hfig=figure;
     4634    set(hfig,'name','civ_status')
     4635    hlist=uicontrol('Style','listbox','Units','normalized', 'Position',[0.05 0.05 0.9 0.75], 'Callback', @open_view_field,'tag','list');
     4636    uicontrol('Style','listbox','Units','normalized', 'Position', [0.05 0.87 0.9 0.1],'tag','msgbox');
     4637    uicontrol('Style','frame','Units','normalized', 'Position', [0.05 0.81 0.9 0.05]);
     4638    BarPosition=[0.05 0.81 0.01 0.05];
     4639    hwaitbar=uicontrol('Style','frame','Units','normalized', 'Position',BarPosition ,'BackgroundColor',[1 0 0],'tag','waitbar');
     4640end
     4641datnum=[];
     4642Tabchar={};
     4643nbfiles=numel(civ_files);
     4644count=0;
     4645while count<nbfiles
     4646    count=0;
     4647    for ifile=1:nbfiles
     4648        detect=exist(civ_files{ifile},'file'); % check the existence of the file
     4649        if detect==0
     4650            lastfield='not created';
     4651        else
     4652            datfile=dir(civ_files{ifile});
     4653            datnum(ifile)=datenum(datfile.date);
     4654            filefound(ifile)={datfile.name};
     4655            lastfield='';
     4656            % check the content  netcdf file
     4657            Data=nc2struct(civ_files{ifile},'ListGlobalAttribute','patch2','fix2','civ2','patch','fix');
     4658            if ~isempty(Data.patch2) && isequal(Data.patch2,1)
     4659                lastfield='patch2';
     4660            elseif ~isempty(Data.fix2) && isequal(Data.fix2,1)
     4661                lastfield='fix2';
     4662            elseif ~isempty(Data.civ2) && isequal(Data.civ2,1);
     4663                lastfield='civ2';
     4664            elseif ~isempty(Data.patch) && isequal(Data.patch,1);
     4665                lastfield='patch1';
     4666            elseif ~isempty(Data.fix) && isequal(Data.fix,1);
     4667                lastfield='fix1';
     4668            else
     4669                lastfield='civ1';
     4670            end
     4671        end
     4672        if strcmp(lastfield,option)
     4673            count=count+1;
     4674        end
     4675        [rr,filename,ext]=fileparts(civ_files{ifile});
     4676        Tabchar{ifile,1}=[fullfile([subdir extdir],filename) ext  '...' lastfield];
     4677    end
     4678    if isempty(datnum)
     4679         message='no civ result created yet';
     4680    else
     4681        datnum=datnum(find(datnum));%keep the non zero values corresponding to existing files
     4682        [first,ind]=min(datnum);
     4683        [last,indlast]=max(datnum);
     4684        message={[num2str(count) ' file(s) done over ' num2str(nbfiles)] ;['oldest modification:  ' cell2mat(filefound(ind)) ' : ' datestr(first)];...
     4685            ['latest modification:  ' cell2mat(filefound(indlast)) ' : ' datestr(last)]};
     4686    end
     4687    hfig=findobj(allchild(0),'name','civ_status');
     4688    if isempty(hfig)
     4689        set(handles.status,'Value',0)%stop program if the figure has been suppressed
     4690        return
     4691    else
     4692        hlist=findobj(hfig,'tag','list');
     4693        hmsgbox=findobj(hfig,'tag','msgbox');
     4694        hwaitbar=findobj(hfig,'tag','waitbar');
     4695        set(hlist,'String',Tabchar)
     4696        set(hmsgbox,'String', message)
     4697        if count>0
     4698            BarPosition(3)=0.9*count/nbfiles;
     4699            set(hwaitbar,'Position',BarPosition)
     4700        end
     4701    end
     4702    set(hlist,'UserData',rootroot)
     4703    pause(5)% wait 5 seconds for next check
     4704end
     4705
     4706   
     4707%-------------------------------------------------------------------   
     4708% call 'view_field.fig' to display the selected field
     4709function open_view_field(hObject, eventdata)
     4710%-------------------------------------------------------------------
     4711     list=get(gcbo,'String');
     4712     index=get(gcbo,'Value');
     4713     rootroot=get(gcbo,'UserData');
     4714     filename=list{index};
     4715     ind_dot=findstr(filename,'...');
     4716     filename=filename(1:ind_dot-1);
     4717      filename=fullfile(rootroot,filename);
     4718      if exist(filename,'file')%visualise the vel field if it exists
     4719        [Field,VelTypeOut]=read_civxdata(filename);
     4720        view_field(Field)
     4721      end
     4722
     4723
  • trunk/src/geometry_calib.m

    r168 r177  
    974974if choice
    975975    set(handles.edit_append,'BackgroundColor',[1 1 0])
     976    huvmat=findobj(allchild(0),'tag','uvmat');
     977    if ishandle(huvmat)
     978        hhuvmat=guidata(huvmat);
     979        set(hhuvmat.edit_object,'Value',0)
     980        set(hhuvmat.edit_object,'BackgroundColor',[0.7 0.7 0.7])
     981    end
    976982else
    977983    set(handles.edit_append,'BackgroundColor',[0.7 0.7 0.7])
  • trunk/src/mouse_down.m

    r156 r177  
    2424function xy=mouse_down(hObject,eventdata)
    2525
    26 %MouseAction='none'; %default
    2726huvmat=findobj(allchild(0),'tag','uvmat');%find the uvmat interface handle which controls theoption of  mouse action
    2827if isempty(huvmat)
     
    3130hhuvmat=guidata(huvmat);%handles of elements in uvmat
    3231UvData=get(huvmat,'UserData');
    33 %MouseAction='none'; %default
    3432currentfig=hObject;
    3533hhcurrentfig=guidata(currentfig);
    3634test_zoom=get(hhcurrentfig.zoom,'Value');%test for zoom action, first priority
    37 % if isfield(UvData,'MouseAction')
    38 %     MouseAction=UvData.MouseAction;% get the mouse action from the uvmat GUI: options:
    39 % end
    40 
    41 %test_cal=get(handles.cal,'Value');
    42 % test_cal=strcmp(MouseAction,'calib');
    43 test_ruler=isequal(get(hhuvmat.MenuRuler,'checked'),'on');%test for ruler  action, second priority
    44 %test_ruler=strcmp(MouseAction,'ruler');
    45 %test_edit=strcmp(MouseAction,'edit_object');
     35test_ruler=isequal(get(hhuvmat.MenuRuler,'checked'),'on');%test for ruler  action, second priority;
    4636test_edit=get(hhuvmat.edit_object,'Value');%test for object editing, third priority
    47 %test_edit_vect=strcmp(MouseAction,'edit_vect');%test for vector editing,  priority 4
    4837test_edit_vect=get(hhuvmat.edit_vect,'Value');%test for vector editing,  priority 4
    4938test_create=isequal(get(hhuvmat.MenuObject,'checked'),'on');% test for object creation,  priority 5
     
    6352    end
    6453end
    65 %test_create=~test_zoom && strcmp(MouseAction,'create_object')&&~test_edit && ~test_edit_vect ;% || isequal(MouseAction,'create_mask'));
    6654xdisplay=[];%default
    6755ydisplay=[];%default
    6856AxeData=[];%default
    6957
    70 %% edit an existing point or line if found
     58%% determine the currently selected items
    7159hcurrentobject=gco;% current object handle (selected by the mouse)
    7260hcurrentfig=hObject;% current figure handle
    7361fig_tag=get(hcurrentfig,'Tag');
    74 tag_obj=get(gco,'Tag');
     62tag_obj=get(gco,'Tag');%tag of the currently selected object
    7563xy=[];%default
    7664xy_fig=get(hcurrentfig,'CurrentPoint');% current point of the current figure (gcbo)
     
    367355    end
    368356    if isequal(Field.FF(ivec),0)
    369         Field.FF(ivec)=100 %mark vector #ivec as false
     357        Field.FF(ivec)=100; %mark vector #ivec as false
    370358    else
    371359        Field.FF(ivec)=0;
  • trunk/src/plot_object.m

    r156 r177  
    9292
    9393%% default input parameters
    94 if ~isfield(ObjectData,'ProjMode')|isempty(ObjectData.ProjMode)
     94if ~isfield(ObjectData,'ProjMode')||isempty(ObjectData.ProjMode)
    9595     ObjectData.ProjMode='projection';%default
    9696end
    97 if ~isfield(ObjectData,'Coord')|isempty(ObjectData.Coord)
     97if ~isfield(ObjectData,'Coord')||isempty(ObjectData.Coord)
    9898     ObjectData.Coord=[0 0 0];%default
    9999end
    100 if ~isfield(ObjectData,'Phi')|isempty(ObjectData.Phi)
     100if ~isfield(ObjectData,'Phi')||isempty(ObjectData.Phi)
    101101     ObjectData.Phi=0;%default
    102102end
     
    131131    YMax=max(XMax,YMax);
    132132    YMax=max(YMax,ZMax);
    133 elseif isequal(ObjectData.Style,'rectangle')|isequal(ObjectData.Style,'ellipse')|isequal(ObjectData.Style,'volume')
     133elseif isequal(ObjectData.Style,'rectangle')||isequal(ObjectData.Style,'ellipse')||isequal(ObjectData.Style,'volume')
    134134    if  isequal(YMax,0)
    135135        ylim=get(haxes,'YLim');
     
    159159    xline=ObjectData.Coord(:,1);
    160160    yline=ObjectData.Coord(:,2);
     161    nbpoints=numel(xline);
    161162    if isequal(ObjectData.Style,'polygon')
    162163        xline=[xline; ObjectData.Coord(1,1)];%closing the line
    163164        yline=[yline; ObjectData.Coord(1,2)];
    164     elseif isequal(ObjectData.Style,'plane')| isequal(ObjectData.Style,'volume')
     165    elseif isequal(ObjectData.Style,'plane')|| isequal(ObjectData.Style,'volume')
    165166        phi=ObjectData.Phi*pi/180;%angle in radians
    166167        Xend_x=xline(1)+XMax*cos(phi);
     
    180181            SubLineStyle='--'; %range of projection marked by dash
    181182            if isfield (ObjectData,'DX')
    182                rmfield(ObjectData,'DX');
     183               ObjectData=rmfield(ObjectData,'DX');
    183184            end
    184185            if isfield (ObjectData,'DY')
    185                rmfield(ObjectData,'DY');
     186               ObjectData=rmfield(ObjectData,'DY');
    186187            end
    187188        elseif isequal(ObjectData.ProjMode,'filter')
     
    189190        end
    190191    end
    191     if isequal(ObjectData.Style,'line')|isequal(ObjectData.Style,'polyline')|isequal(ObjectData.Style,'polygon')
     192    if isequal(ObjectData.Style,'line')||isequal(ObjectData.Style,'polyline')||isequal(ObjectData.Style,'polygon')
    192193        if length(xline)<2
    193194            theta=0;
     
    223224        scale_x=2*1.4*XMax/npMx;
    224225        scale_y=2*1.4*YMax/npMy;
    225         xi=[0.5:npMx-0.5]*scale_x+xlim(1);
    226         yi=[0.5:npMy-0.5]*scale_y+ylim(1);
     226        xi=(0.5:npMx-0.5)*scale_x+xlim(1);
     227        yi=(0.5:npMy-0.5)*scale_y+ylim(1);
    227228        [Xi,Yi]=meshgrid(xi,yi);
    228229        X2Max=XMax*XMax;
     
    231232        distY=(Yi-ObjectData.Coord(1,2));
    232233        flag=(distX.*distX/X2Max+distY.*distY/Y2Max)<1;
    233     elseif isequal(ObjectData.Style,'rectangle')|isequal(ObjectData.Style,'volume')
     234    elseif isequal(ObjectData.Style,'rectangle')||isequal(ObjectData.Style,'volume')
    234235        XimaMin=ObjectData.Coord(1,1)-XMax;
    235236        XimaMax=ObjectData.Coord(1,1)+XMax;
     
    240241        scale_x=2*1.4*XMax/npMx;
    241242        scale_y=2*1.4*YMax/npMy;
    242         xi=[0.5:npMx-0.5]*scale_x+xlim(1);
    243         yi=[0.5:npMy-0.5]*scale_y+ylim(1);
     243        xi=(0.5:npMx-0.5)*scale_x+xlim(1);
     244        yi=(0.5:npMy-0.5)*scale_y+ylim(1);
    244245        [Xi,Yi]=meshgrid(xi,yi);
    245246        distX=abs(Xi-ObjectData.Coord(1,1));
     
    270271
    271272PlotData=[];%default
     273
    272274%% MODIFY AN EXISTING OBJECT PLOT
    273275if test_newobj==0;
     
    301303           for ipt=1:length(PlotData.DeformPoint)
    302304               if ishandle(PlotData.DeformPoint(ipt))
    303                    if length(xline)>=ipt &   length(yline)>=ipt   
     305                   if nbpoints>=ipt 
    304306                        set(PlotData.DeformPoint(ipt),'XData',xline(ipt),'YData',yline(ipt));
    305307                    end
    306308               end
    307309           end
    308            if length(xline)>length(PlotData.DeformPoint)
    309                for ipt=length(PlotData.DeformPoint)+1:length(xline)
     310           if nbpoints>length(PlotData.DeformPoint)
     311               for ipt=length(PlotData.DeformPoint)+1:nbpoints
    310312                    PlotData.DeformPoint(ipt)=line(xline(ipt),yline(ipt),'Color',col,'LineStyle','.','Tag','DeformPoint',...
    311313                        'SelectionHighlight','off','UserData',hplot);
     
    314316           end
    315317        end
    316     elseif isequal(ObjectData.Style,'rectangle')|isequal(ObjectData.Style,'ellipse')
     318    elseif isequal(ObjectData.Style,'rectangle')||isequal(ObjectData.Style,'ellipse')
    317319        set(hplot,'Position',[ObjectData.Coord(1,1)-XMax ObjectData.Coord(1,2)-YMax 2*XMax 2*YMax])         
    318320    end
     
    334336    hother=findobj('Tag','proj_object');%find all the proj objects
    335337    for iobj=1:length(hother)
    336         if isequal(get(hother(iobj),'Type'),'rectangle')|isequal(get(hother(iobj),'Type'),'patch')
     338        if strcmp(get(hother(iobj),'Type'),'rectangle')|| strcmp(get(hother(iobj),'Type'),'patch')
    337339            set(hother(iobj),'EdgeColor','b')
    338340            if isequal(get(hother(iobj),'FaceColor'),'m')
     
    363365              end
    364366        end
    365     elseif  isequal(ObjectData.Style,'line')|isequal(ObjectData.Style,'polyline')|...       
    366           isequal(ObjectData.Style,'polygon') |isequal(ObjectData.Style,'plane')|isequal(ObjectData.Style,'volume')%  (isequal(ObjectData.Style,'polygon') & ~test_patch) |isequal(ObjectData.Style,'plane')
     367    elseif  strcmp(ObjectData.Style,'line')||strcmp(ObjectData.Style,'polyline')||...       
     368          strcmp(ObjectData.Style,'polygon') ||strcmp(ObjectData.Style,'plane')||strcmp(ObjectData.Style,'volume')%  (isequal(ObjectData.Style,'polygon') & ~test_patch) |isequal(ObjectData.Style,'plane')
    367369        hh=line(xline,yline,'Color',col);
    368         if ~isequal(ObjectData.Style,'plane')& ~isequal(ObjectData.Style,'volume')
     370        if ~strcmp(ObjectData.Style,'plane') && ~strcmp(ObjectData.Style,'volume')
     371            PlotData.SubObject(1)=line(xinf,yinf,'Color',col,'LineStyle',SubLineStyle,'Tag','proj_object');%draw sub-lines
     372            PlotData.SubObject(2)=line(xsup,ysup,'Color',col,'LineStyle',SubLineStyle,'Tag','proj_object');
    369373            for ipt=1:sizcoord(1)
    370374                PlotData.DeformPoint(ipt)=line(ObjectData.Coord(ipt,1),ObjectData.Coord(ipt,2),'Color',...
    371375                      col,'LineStyle','none','Marker','.','Tag','DeformPoint','SelectionHighlight','off','UserData',hh);
    372376            end
    373             PlotData.SubObject(1)=line(xinf,yinf,'Color',col,'LineStyle',SubLineStyle,'Tag','proj_object');%draw sub-lines
    374             PlotData.SubObject(2)=line(xsup,ysup,'Color',col,'LineStyle',SubLineStyle,'Tag','proj_object');
    375377        end
    376378   
    377     elseif isequal(ObjectData.Style,'rectangle')
     379    elseif strcmp(ObjectData.Style,'rectangle')
    378380        hh=rectangle('Position',[ObjectData.Coord(1,1)-XMax ObjectData.Coord(1,2)-YMax 2*XMax 2*YMax],'EdgeColor',col);   
    379     elseif isequal(ObjectData.Style,'ellipse')
     381    elseif strcmp(ObjectData.Style,'ellipse')
    380382        hh=rectangle('Curvature',[1 1],'Position',[ObjectData.Coord(1,1)-XMax ObjectData.Coord(1,2)-YMax 2*XMax 2*YMax],'EdgeColor',col);
    381383    else
     
    387389        hold on
    388390        hhh=image([xlim(1)+dx/2 xlim(2)-dx/2],[ylim(1)+dy/2 ylim(2)-dy/2],imflag,'Tag','proj_object','HitTest','off');
    389         set(hhh,'AlphaData',(flag)*0.2)
     391        set(hhh,'AlphaData',(flag)*0.2)% set partial transparency to the filling color
    390392        PlotData.SubObject=hhh;   
    391393    end
  • trunk/src/uvmat.m

    r174 r177  
    264264          set(handles.MenuFile_1_1,'Label',h.MenuFile_1);
    265265      end
    266       if isfield(h,'MenuFile_1')
     266      if isfield(h,'MenuFile_2')
    267267          set(handles.MenuFile_2,'Label',h.MenuFile_2);
    268268          set(handles.MenuFile_2_1,'Label',h.MenuFile_2);
    269269      end
    270       if isfield(h,'MenuFile_1')
     270      if isfield(h,'MenuFile_3')
    271271          set(handles.MenuFile_3,'Label',h.MenuFile_3);
    272272          set(handles.MenuFile_3_1,'Label',h.MenuFile_3);
    273273      end
    274       if isfield(h,'MenuFile_1')
     274      if isfield(h,'MenuFile_4')
    275275          set(handles.MenuFile_4,'Label',h.MenuFile_4);
    276276          set(handles.MenuFile_4_1,'Label',h.MenuFile_4);
    277277      end
    278       if isfield(h,'MenuFile_1')
     278      if isfield(h,'MenuFile_5')
    279279          set(handles.MenuFile_5,'Label',h.MenuFile_5);
    280280          set(handles.MenuFile_5_1,'Label',h.MenuFile_5);
     
    282282      if isfield(h,'transform_fct') && iscell(h.transform_fct)
    283283         for ilist=1:length(h.transform_fct);
    284              [path,file]=fileparts(h.transform_fct{ilist});
    285              addpath(path)
    286              if exist(file,'file')
     284             if exist(h.transform_fct{ilist},'file')
     285                [path,file]=fileparts(h.transform_fct{ilist});
     286                addpath(path)
     287%              if exist(file,'file')
    287288                h_func=str2func(file);
     289                rmpath(path)
    288290                testexist=[testexist 1];
    289291             else
     292                file='';
    290293                h_func=[];
    291294                testexist=[testexist 0];
    292295             end
    293296             fct_handle=[fct_handle; {h_func}]; %concatene the list of paths
    294              rmpath(path)
    295297             menu_str=[menu_str; {file}];
    296298         end
     
    44134415    set(handles.zoom,'Value',0)
    44144416    zoom_Callback(hObject, eventdata, handles)
     4417    hgeometry_calib=findobj(allchild(0),'tag','geometry_calib');
     4418    if ishandle(hgeometry_calib)
     4419        hhgeometry_calib=guidata(hgeometry_calib);
     4420        set(hhgeometry_calib.edit_append,'Value',0)% desactivate mouse action in geometry_calib
     4421        set(hhgeometry_calib.edit_append,'BackgroundColor',[0.7 0.7 0.7])
     4422    end
    44154423else
    44164424    UvData.MouseAction='none';
     
    50755083    delete(hset_object)% delete existing version of set_object
    50765084end
     5085hgeometry_calib=findobj(allchild(0),'tag','geometry_calib');
     5086if ishandle(hgeometry_calib)
     5087    hhgeometry_calib=guidata(hgeometry_calib);
     5088    set(hhgeometry_calib.edit_append,'Value',0)% desactivate mouse action in geometry_calib
     5089    set(hhgeometry_calib.edit_append,'BackgroundColor',[0.7 0.7 0.7])
     5090end
    50775091UvData=get(handles.uvmat,'UserData');
    50785092set(handles.edit_object,'Value',0); %suppress the object edit mode
Note: See TracChangeset for help on using the changeset viewer.