Changeset 71


Ignore:
Timestamp:
Mar 29, 2010, 6:34:55 PM (15 years ago)
Author:
sommeria
Message:

civ3D updated: introduction of image size
imadoc2struct: reding of image size from the xml file
set_object, view_field and related functions: improvement of projection object editing
mouse: possibility of adjusting the calibrations points with the mouse

Location:
trunk/src
Files:
24 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/civ.m

    r67 r71  
    2222function varargout = civ(varargin)
    2323
    24 % Last Modified by GUIDE v2.5 10-Jan-2010 22:04:45
     24% Last Modified by GUIDE v2.5 27-Mar-2010 13:41:11
    2525% Begin initialization code - DO NOT EDIT
    2626gui_Singleton = 1;
     
    4444%------------------------------------------------------------------------
    4545% --- Executes just before civ is made visible.
    46 function civ_OpeningFcn(hObject, eventdata, handles, varargin)
     46function civ_OpeningFcn(hObject, eventdata, handles, param)
    4747%------------------------------------------------------------------------
    4848% This function has no output args, see OutputFcn.
     
    6565%default initial parameters
    6666filebase=''; % root file name ('filebase'.civ)
    67 %nom_type=[]; % nomenclature type
    6867ext=[];
    6968testall=0;
    7069browse=[];
    71 
     70%default input parameters:
     71num1=1; % set of field i numbers
     72num2=2; % set of field i numbers
     73num_a=1; % set of field j numbers (fields a)
     74num_b=1; % second set of field j numbers (fields b)
     75subdir='A'; % subdir for the netcdf result files
     76ind_opening=1; % proposed operation number (1=civ1,2=fix1,3=patch1,4=civ2,5=fix2,6=patch2)
    7277%load the initial parameters if the interface is started from uvmat
    73 if ~isempty(varargin)% the interface is opened from uvmat
    74     varcell=varargin{1};
    75     filebase=varcell{1};
    76     nom_type_read=varcell{2};
    77     num1=varcell{3};
    78     num2=varcell{4};
    79     num_a=varcell{5};
    80     num_b=varcell{6};
    81     subdir=varcell{7};
    82     ind_opening=varcell{8};
    83     ext=varcell{11};
    84 else
    85     num1=1; % set of field i numbers
    86     num2=2; % set of field i numbers
    87     num_a=1; % set of field j numbers (fields a)
    88     num_b=1; % second set of field j numbers (fields b)
    89     subdir='A'; % subdir for the netcdf result files
    90     ind_opening=1; % proposed operation number (1=civ1,2=fix1,3=patch1,4=civ2,5=fix2,6=patch2) 
    91 end
    92 
    93 if exist('ext','var') && length(ext)>1 && (~isempty(imformats(ext(2:end)))||...
    94                        isequal(lower(ext),'.avi'));%if an image file has been opened by uvmat
    95         set(handles.ext_ima,'String',ext)
     78if exist('param','var')&&isstruct(param)% the interface is opened from uvmat
     79    filebase=param.RootName;
     80    nom_type_read=param.NomType;
     81    num1=param.num1;
     82    num2=param.num2;
     83    num_a=param.num_a;
     84    num_b=param.num_b;
     85    subdir=param.SubDir;
     86    ind_opening=param.IndOpening;
     87    ext=param.ImaExt;
     88end
     89if ~isempty(ext) && (~isempty(imformats(ext(2:end)))||...
     90                       strcmp(lower(ext),'.avi'));%if an image file has been opened by uvmat
     91        set(handles.ImaExt,'String',ext)
    9692        if exist('nom_type_read','var')
    9793            browse.nom_type_ima=nom_type_read; % the image nomenclature is stored
     
    10298    end
    10399end
    104 set(handles.displ_filebase,'String',filebase);
     100set(handles.RootName,'String',filebase);
    105101set(handles.ImaDoc,'UserData',testall);
    106102set(handles.ImaDoc,'String',ext)
    107103
    108104%read names of the .exe file to adjust the interface according to
    109 %available prog
    110 %read names of the .exe file
     105%available binaries
    111106path_uvmat=which('uvmat');% check the path detected for source file uvmat
    112107path_UVMAT=fileparts(path_uvmat); %path to UVMAT
    113108errormsg=[];%default error message
    114 if isunix
    115     syst='LINUX';
    116 else
    117     syst='WIN';
    118 end
    119109xmlfile=fullfile(path_UVMAT,'PARAM.xml');
    120110if exist(xmlfile,'file')
     
    123113    sparam=convert(t);
    124114    catch
    125          errormsg={[' Problem for reading ' xmlfile]; lasterr};   
     115         errormsg={[' Unable to read the file PARAM.xml defining the civx binaries:']; lasterr};   
    126116    end
    127117else
    128118    errormsg=[xmlfile ' not found: path to civx binaries undefined'];
    129119end
    130 display(syst)
     120
    131121if ~isempty(errormsg)
    132122       msgbox_uvmat('ERROR',errormsg);
    133123end
    134 patch_newBin='';
    135 % todo_patch='';
    136 sge=0;
    137 
    138 if isfield(sparam,'PatchNewBin')
    139     patch_newBin=sparam.PatchNewBin;
    140 end
    141 
    142 if isfield(sparam,'SGE')
    143     sge=str2double(sparam.SGE);
    144 end   
    145 
    146 test_batch=sge;%default
    147 if isfield(sparam,'Todo_path')
    148     todo_path=sparam.Todo_path;
    149     name_todo=fullfile(todo_path,'TODO.txt');
    150     if exist(name_todo,'file')
    151         test_batch=1;
    152     end
    153 end
     124% patch_newBin='';
     125test_batch=0;%default: ,no batch mode available
     126if isfield(sparam,'BatchParam') && isfield(sparam.BatchParam,'BatchMode')
     127    test_batch=strcmp(sparam.BatchParam.BatchMode,'sge'); %sge is currently the only implemented batch mod
     128end
     129% if isfield(sparam,'PatchNewBin')
     130%     patch_newBin=sparam.PatchNewBin;
     131% end
     132% if isfield(sparam,'SGE')
     133%     sge=str2double(sparam.SGE);
     134% end   
     135% test_batch=sge;%default
    154136if test_batch==0
    155137    set(handles.BATCH,'BackgroundColor',[0.831 0.816 0.784])% put the BATCH button in grey (unactivated)
     
    228210set(handles.ref_i,'String',num2str(num_ref_i));
    229211set(handles.ref_j,'String',num2str(num_ref_j));
     212set(handles.ref_i_civ2,'String',num2str(num_ref_i));
     213set(handles.ref_j_civ2,'String',num2str(num_ref_j));
    230214set(handles.browse_root,'UserData',browse);
    231 if ~isempty(varargin)% the interface is opened from uvmat
    232     displ_filebase_Callback(hObject, eventdata, handles);
     215if exist('param','var')%varargin the interface is opened from uvmat
     216    RootName_Callback(hObject, eventdata, handles);
    233217end
    234218
     
    254238%------------------------------------------------------------------------
    255239%get the input file properties
    256 filebase=get(handles.displ_filebase,'String');
     240filebase=get(handles.RootName,'String');
    257241oldfile=''; %default
    258242if isempty(filebase)|| isequal(filebase,'')%loads the previously stored file name and set it as default in the file_input box
     
    331315if length(ext)>1 && (~isempty(imformats(ext([2:end])))||...
    332316                       isequal(ext,'.avi')||isequal(ext,'.AVI'));%if an image file has been opened by uvmat
    333     set(handles.ext_ima,'String',ext)
     317    set(handles.ImaExt,'String',ext)
    334318    browse.nom_type_ima=nom_type;
    335319    browse.field_count=num_i1;
    336320%     A=imread(fileinput);
    337321%     npxy=size(A);
    338 %     set(handles.ext_ima,'UserData',npxy)
     322%     set(handles.ImaExt,'UserData',npxy)
    339323end
    340324set(handles.ImaDoc,'String',ext);
     
    368352    browse.ind_opening=ind_opening;
    369353end
    370 set(handles.displ_filebase,'String',filebase);
     354set(handles.RootName,'String',filebase);
    371355set(handles.ImaDoc,'String',ext);
    372356if ~isempty(num_i1)
     
    379363    set(handles.first_i,'String',num2str(ref_i));
    380364    set(handles.last_i,'String',num2str(ref_i));
    381     set(handles.ref_i,'String',num2str(ref_i));
     365    set(handles.ref_i,'String',num2str(ref_i));
     366    set(handles.ref_i_civ2,'String',num2str(ref_i))
    382367end
    383368if isempty(num_j1)
    384369    set(handles.ref_j,'String','1');
     370    set(handles.ref_j_civ2,'String','1');
    385371else
    386372    ref_j=num_j1;
     
    392378    set(handles.last_j,'String',num2str(ref_j));
    393379    set(handles.ref_j,'String',num2str(ref_j));
     380    set(handles.ref_j_civ2,'String',num2str(ref_j));
    394381end
    395382
     
    439426set(handles.ImaDoc,'UserData',testall);
    440427
    441 displ_filebase_Callback(hObject, eventdata, handles);
     428RootName_Callback(hObject, eventdata, handles);
    442429
    443430%------------------------------------------------------------------------
    444431function ImaDoc_Callback(hObject, eventdata, handles)
    445432%------------------------------------------------------------------------
    446 displ_filebase_Callback(hObject, eventdata, handles)
     433RootName_Callback(hObject, eventdata, handles)
    447434
    448435%------------------------------------------------------------------------
    449436% --- function activated when a new filebase (image series) is introduced
    450 function displ_filebase_Callback(hObject, eventdata, handles)
     437function RootName_Callback(hObject, eventdata, handles)
    451438%------------------------------------------------------------------------
    452439global test_batch
    453440set(handles.compare,'Visible','on')
    454 ext_ima=get(handles.ext_ima,'String');
     441ext_ima=get(handles.ImaExt,'String');
    455442nom_type_ima=[];%default
    456443field_count=1;%default
    457444nom_type_nc=[];
    458445time=[];
    459 TimeUnit=[]; %default
    460 CoordUnit=[];%default
     446TimeUnit='frame'; %default
     447CoordUnit='px';%default
    461448pxcmx_search=[];%default
    462449pxcmy_search=[];%default
    463 filebase=get(handles.displ_filebase,'String');
     450filebase=get(handles.RootName,'String');
    464451
    465452ext=get(handles.ImaDoc,'String');
     
    530517    set(handles.ref_i,'Visible','On')%use a reference index
    531518    set(handles.ref_j,'Visible','On')
    532     set(handles.dt,'Visible','Off')
    533     set(handles.dt_text,'String','')
     519%     set(handles.dt,'Visible','Off')
     520 %   set(handles.root_txt,'String','')
    534521elseif isequal(ext,'.avi') || isequal(ext,'.AVI')
    535522    set(handles.ref_j,'Visible','Off')
    536     set(handles.dt,'Visible','Off')
    537     set(handles.dt_text,'String','ref. ind.')
     523 %   set(handles.dt,'Visible','Off')
     524 %   set(handles.root_txt,'String','ref. ind.')
    538525else
    539526    set(handles.ref_i,'Visible','Off')
    540527    set(handles.ref_j,'Visible','Off')
    541     set(handles.dt,'Visible','On')
    542     set(handles.dt_text,'String','dt(ms)=')
     528 %   set(handles.dt,'Visible','On')
     529 %   set(handles.root_txt,'String','dt(ms)=')
    543530end
    544531testima_xml=0;
     
    550537    end
    551538elseif isequal(ext,'.xml')
    552     [XmlData,warntext]=imadoc2struct([filebase '.xml']);
     539    [XmlData,warntext]=imadoc2struct([filebase '.xml'])
    553540    if isfield(XmlData,'Time')
    554541        time=XmlData.Time;
     
    562549        fullname=fullfile(fileparts(filebase),XmlData.Heading.ImageName); %full name (including path) of the first image defined by the xmle file,
    563550        if ~exist(fullname,'file')
    564 %             testima_xml=1;
    565 %         else
    566551            msgbox_uvmat('WARNING',['FirstImage ' fullname ' defined in the xml file does not exist'])
    567552        end
    568553    end
    569     if isfield(XmlData,'Camera')
    570         if isfield(XmlData.Camera,'TimeUnit')
    571             TimeUnit=XmlData.Camera.TimeUnit;
    572         end
    573         if isfield(XmlData.Camera,'ImageSize')
    574            ImageSize=XmlData.Camera.ImageSize;
    575            if ~isempty(ImageSize)&& ~isempty(ImageSize)
    576                xindex=findstr(ImageSize,'x');
    577 %                if length(xindex)>=2
    578 %                     npx=str2num(ImageSize(1:xindex(1)-1));
    579 %                     npy=str2num(ImageSize(xindex(1)+1:xindex(2)-1));
    580 %                end
    581            end
    582        end
     554    if isfield(XmlData,'TimeUnit')
     555        TimeUnit=XmlData.TimeUnit;
     556    end
     557    if isfield(XmlData,'Npx')
     558        npx=XmlData.Npx;
     559        npy=XmlData.Npy;
    583560    end
    584561    pxcmx_search=1;
     
    610587        elseif error==1, msgbox_uvmat('WARNING','inconsistent number of fields in the .civ file');
    611588        end
    612 %         ext_ima='.png';
     589%         ImaExt='.png';
    613590        nom_type_ima='png_old';       
    614591elseif isequal(lower(ext),'.avi')
     
    623600        end
    624601        time=(dt*[0:nbfield-1])';%list of image times   
    625         set(handles.dt,'String',num2str(dt*1000));%store the time interval between successive images
     602        %set(handles.dt,'String',num2str(dt*1000));%store the time interval between successive images
    626603end
    627604if isempty(time)
     
    689666    first_i=max(field_i+1,1);
    690667        %determine the set of times and possible intervals for CIV
    691     dt=(1/1000)*str2num(get(handles.dt,'String'));
    692     time=(dt*[0:nb_field-1])';
     668 %   dt=(1/1000)*str2num(get(handles.dt,'String'));
     669    time=[0:nb_field-1]';% time=file index -1  by default
    693670    set(handles.mode,'String',{'series(Di)'})
    694671end
     
    703680        nbfield=size(time,1);
    704681        nbfield2=size(time,2);
    705         set(handles.displ_filebase,'UserData',time); %store the set of times
    706         if isempty(TimeUnit)
    707             set(handles.dt_unit,'String','dt in e-03');
    708             set(handles.TimeUnit,'String','');
    709         else
    710             set(handles.dt_unit,'String',['dt in m' TimeUnit]);
    711             set(handles.TimeUnit,'String',TimeUnit);
    712         end
     682        set(handles.RootName,'UserData',time); %store the set of times
     683        set(handles.dt_unit,'String',['dt in m' TimeUnit]);
     684        set(handles.dt_unit_civ2,'String',['dt in m' TimeUnit]);
     685        set(handles.TimeUnit,'String',TimeUnit);
    713686        set(handles.nb_field,'String',num2str(nbfield));
    714687        set(handles.nb_field2,'String',num2str(nbfield2));
    715688    end
    716689end
    717 set(handles.CoordUnit,'String',[CoordUnit '/'])
     690set(handles.CoordUnit,'String',CoordUnit)
    718691set(handles.calcul_search,'UserData',[pxcmx_search pxcmy_search]);
    719692% npxy=[npy npx];
    720 set(handles.ext_ima,'String',ext_ima)
     693set(handles.ImaExt,'String',ext_ima)
    721694set(handles.first_i,'String',num2str(first_i));
    722695set(handles.last_i,'String',num2str(last_i));%
     
    824797ref_i=str2num(get(handles.ref_i,'String'));
    825798% last_i=str2num(get(handles.last_i,'String'));
    826 time=get(handles.displ_filebase,'UserData'); %get the set of times
     799time=get(handles.RootName,'UserData'); %get the set of times
    827800siztime=size(time);
    828801nbfield=siztime(1);
     
    967940set(gcf,'Pointer','watch')
    968941%nomenclature types
    969 filebase=get(handles.displ_filebase,'String');
     942filebase=get(handles.RootName,'String');
    970943[filepath,Nme,ext_dir]=fileparts(filebase);
    971944browse=get(handles.browse_root,'UserData');
     
    1014987    ref_j=str2double(get(handles.ref_j,'String'));
    1015988end
    1016 time=get(handles.displ_filebase,'UserData');%get the set of times
     989time=get(handles.RootName,'UserData');%get the set of times
    1017990if isempty(time)
    1018991    time=[0 1];
    1019992end
    1020 dt_unit=str2double(get(handles.dt,'String'));% used when there is no image documentation file
     993%dt_unit=str2double(get(handles.dt,'String'));% used when there is no image documentation file
     994dt_unit=1000;%default
    1021995displ_num=get(handles.list_pair_civ1,'UserData');
    1022996
     
    10741048    if testpair
    10751049              displ_pair{1}=['Di= ' num2str(-floor(browse.incr_pair(1)/2)) '|' num2str(ceil(browse.incr_pair(1)/2))];       
    1076     elseif ~isequal(get(handles.dt_text,'String'),'dt(ms)=')
    1077        for ipair=1:nbpair
    1078           if select(ipair) 
    1079               if size(time,1)>=ref_i+displ_num(4,ipair) && size(time,2)>=ref_j+displ_num(2,ipair)
    1080               dt=time(ref_i+displ_num(4,ipair),ref_j+displ_num(2,ipair))-time(ref_i+displ_num(3,ipair),ref_j+displ_num(1,ipair));%time interval dt
    1081               displ_pair{ipair}=['Di= ' num2str(-floor(ipair/2)) '|' num2str(ceil(ipair/2)) ' :dt= ' num2str(dt*1000)];
    1082               end
    1083           else
    1084              displ_pair{ipair}='...'; %pair not displayed in the menu
    1085           end
    1086        end
     1050%     elseif ~isequal(get(handles.root_txt,'String'),'dt(ms)=')
     1051%        for ipair=1:nbpair
     1052%           if select(ipair) 
     1053%               if size(time,1)>=ref_i+displ_num(4,ipair) && size(time,2)>=ref_j+displ_num(2,ipair)
     1054%               dt=time(ref_i+displ_num(4,ipair),ref_j+displ_num(2,ipair))-time(ref_i+displ_num(3,ipair),ref_j+displ_num(1,ipair));%time interval dt
     1055%               displ_pair{ipair}=['Di= ' num2str(-floor(ipair/2)) '|' num2str(ceil(ipair/2)) ' :dt= ' num2str(dt*1000)];
     1056%               end
     1057%           else
     1058%              displ_pair{ipair}='...'; %pair not displayed in the menu
     1059%           end
     1060%        end
    10871061    else
    10881062       for ipair=1:nbpair
     
    11541128set(gcf,'Pointer','watch')
    11551129%nomenclature types
    1156 filebase=get(handles.displ_filebase,'String');
     1130filebase=get(handles.RootName,'String');
    11571131[filepath,Nme,ext_dir]=fileparts(filebase);
    11581132browse=get(handles.browse_root,'UserData');
     
    12051179%     return
    12061180% end
    1207 ref_i=str2num(get(handles.ref_i,'String'));
     1181ref_i=str2num(get(handles.ref_i_civ2,'String'));
    12081182if isequal(mode,'pair j1-j2')%|isequal(mode,'st_pair j1-j2')
    12091183    ref_j=0;
    12101184else
    1211     ref_j=str2num(get(handles.ref_j,'String'));
    1212 end
    1213 % if isequal(get(handles.dt_text,'String'),'dt(ms)=')%simple series(Di) with equal interval
    1214 %     ref_i=ceil((first_i+last_i)/2);
    1215 %     ref_j=1;
    1216 % end
    1217 %     ref_i=browse.num_ref;%field number initially selected by the browser
    1218 time=get(handles.displ_filebase,'UserData'); %get the set of times
     1185    ref_j=str2num(get(handles.ref_j_civ2,'String'));
     1186end
     1187time=get(handles.RootName,'UserData'); %get the set of times
    12191188if isempty(time)
    12201189    time=[0 1];%default
    12211190end
    1222 dt_unit=str2num(get(handles.dt,'String'));% used when there is no image documentation file
     1191%dt_unit=str2num(get(handles.dt,'String'));% used when there is no image documentation file
     1192dt_unit=1000;
    12231193displ_num=get(handles.list_pair_civ1,'UserData');
    12241194
     
    12741244end
    12751245if isequal(mode,'series(Di)') % | isequal(mode,'st_series(Di)')
    1276 %     if  ~isequal(get(handles.dt_text,'String'),'dt(ms)=')
    12771246       for ipair=1:nbpair
    12781247          if select(ipair)
     
    15851554%
    15861555% %root name
    1587 % filebase=get(handles.displ_filebase,'String');
     1556% filebase=get(handles.RootName,'String');
    15881557% if isempty(filebase)||isequal(filebase,'')
    15891558%     msgbox_uvmat('ERROR','no input files')
     
    16961665% %RUN FIX1
    16971666% if box_test(2)==1
    1698 %     filebase=get(handles.displ_filebase,'String');
     1667%     filebase=get(handles.RootName,'String');
    16991668%     %names of the civ1 fields
    17001669%     field1.vel_type='civ1';
     
    17261695%             maskname=maskdispl;
    17271696%         else
    1728 %             maskbase=[get(handles.displ_filebase,'String') '_' maskdispl]; % mask root name
     1697%             maskbase=[get(handles.RootName,'String') '_' maskdispl]; % mask root name
    17291698%         end
    17301699%     end
     
    17571726%                       maskflag=0;
    17581727%                  else
    1759 %                      maskbase=[get(handles.displ_filebase2,'String') '_' maskdispl]; % mask root name
     1728%                      maskbase=[get(handles.RootName2,'String') '_' maskdispl]; % mask root name
    17601729%                      nbslice_mask=str2num(maskdispl(1:end-4)); %
    17611730%                      num1_mask=mod(num1_civ1(ifile)-1,nbslice_mask)+1;               
     
    18821851%             maskname=maskdispl;
    18831852%         else
    1884 %             maskbase=[get(handles.displ_filebase,'String') '_' maskdispl]; % mask root name
     1853%             maskbase=[get(handles.RootName,'String') '_' maskdispl]; % mask root name
    18851854%         end
    18861855%     end
     
    19161885%                       maskflag=0;
    19171886%                  else
    1918 %                       maskbase=[get(handles.displ_filebase2,'String') '_' maskdispl]; % mask root name
     1887%                       maskbase=[get(handles.RootName2,'String') '_' maskdispl]; % mask root name
    19191888%                       nbslice_mask=str2num(maskdispl(1:end-4)); %
    19201889%                       num1_mask=mod(num1_civ2(ifile)-1,nbslice_mask)+1;
     
    20772046
    20782047%root name
    2079 filebase=get(handles.displ_filebase,'String');
     2048filebase=get(handles.RootName,'String');
    20802049if isempty(filebase)||isequal(filebase,'')
    20812050    msgbox_uvmat('ERROR','no input files')
     
    21982167            rankend=min(find(double(wwrest)==10))-1;
    21992168            filebase=[wwrest(1:rankend) filebase(3:end)];
    2200             set(handles.displ_filebase,'String',filebase);
     2169            set(handles.RootName,'String',filebase);
    22012170        end
    22022171    else
     
    23752344% for ifile=1:nbfield
    23762345p1text=[];%initiate command text
    2377 time=get(handles.displ_filebase,'UserData'); %get the set of times
     2346time=get(handles.RootName,'UserData'); %get the set of times
    23782347civAll=get(handles.Experimental,'Value'); % Boolean for new civ excution method
    23792348for ifile=1:nbfield
     
    28242793%------------------------------------------------------------------------
    28252794%get the filename root, nomenclature and numbers
    2826 filebase=get(handles.displ_filebase,'String');
     2795filebase=get(handles.RootName,'String');
    28272796browse=get(handles.browse_root,'UserData');
    28282797compare_list=get(handles.compare,'String');
     
    28362805    mode=mode_list{mode_value};
    28372806end
    2838 time=get(handles.displ_filebase,'UserData'); %get the set of times
    2839 ext_ima=get(handles.ext_ima,'String');
     2807time=get(handles.RootName,'UserData'); %get the set of times
     2808ext_ima=get(handles.ImaExt,'String');
    28402809nom_type_nc=browse.nom_type_nc;
    28412810nom_type_ima2=browse.nom_type_ima;
     
    28512820    [Path2,Name2]=fileparts(filebase_B);
    28522821    Path1=Path2;
    2853     Name1=get(handles.displ_filebase2,'String');% root name of the first field series for stereo
     2822    Name1=get(handles.RootName_1,'String');% root name of the first field series for stereo
    28542823    filebase_A=fullfile(Path1,Name1);
    28552824    if length(Name1)>6
     
    34073376       end
    34083377    end
    3409     %npxy=get(handles.ext_ima,'UserData');
     3378    %npxy=get(handles.ImaExt,'UserData');
    34103379% %     if numel(npxy)<2
    34113380%     
    3412 %         filename=name_generator(filebase_ima1,num1_civ1(1),num_a_civ1(1),ext_ima,nom_type_ima1);
     3381%         filename=name_generator(filebase_ima1,num1_civ1(1),num_a_civ1(1),ImaExt,nom_type_ima1);
    34133382%         A=imread(filename);
    34143383%         npxy=size(A);
     
    35093478npx=num2str(sizim(2));
    35103479npy=num2str(sizim(1));
    3511 time=get(handles.displ_filebase,'UserData'); %get the set of times
     3480time=get(handles.RootName,'UserData'); %get the set of times
    35123481gridname='';%default  ='noFile use default'
    35133482gridflag='n';%default
     
    35383507end
    35393508 %main loop
    3540 filebase=get(handles.displ_filebase,'String');
     3509filebase=get(handles.RootName,'String');
    35413510sizcell=size(filecell);
    35423511nbfield=sizcell(1);
     
    37083677% npx=num2str(sizim(2));
    37093678% npy=num2str(sizim(1));
    3710 % time=get(handles.displ_filebase,'UserData'); %get the set of times
    3711 % filebase=get(handles.displ_filebase,'String');
     3679% time=get(handles.RootName,'UserData'); %get the set of times
     3680% filebase=get(handles.RootName,'String');
    37123681% %grid
    37133682% gridname='';%default  ='noFile use default'
     
    39323901% ref_i=ceil((first_i+last_i)/2);
    39333902set(handles.ref_i,'String', num2str(first_i))% reference index for pair dt = first index
     3903set(handles.ref_i_civ2,'String', num2str(first_i))% reference index for pair dt = first index
    39343904ref_i_Callback(hObject, eventdata, handles)%refresh dispaly of dt for pairs (in case of non constant dt)
    39353905
     
    39493919index=get(handles.list_pair_civ1,'Value');
    39503920displ_num=get(handles.list_pair_civ1,'UserData');
    3951 time=get(handles.displ_filebase,'UserData'); %get the set of times
     3921time=get(handles.RootName,'UserData'); %get the set of times
    39523922pxcm_xy=get(handles.calcul_search,'UserData');
    39533923pxcmx=pxcm_xy(1);
     
    40213991else
    40223992    mask_displ='no mask'; %default
    4023     filebase=get(handles.displ_filebase,'String');
     3993    filebase=get(handles.RootName,'String');
    40243994    [ nbslice_mask, flag_mask]=get_mask(filebase,handles);
    40253995    if isequal(flag_mask,1)
     
    40273997    elseif get(handles.compare,'Value')>1 & ~isequal(mask_displ,'no mask')% look for the second mask series
    40283998            common_path=fileparts(filebase);
    4029             filebase_a=fullfile(common_path,get(handles.displ_filebase2,'String'));
     3999            filebase_a=fullfile(common_path,get(handles.RootName_1,'String'));
    40304000            [nbslice_a, flag_mask_a]=get_mask(filebase_a,handles);
    40314001            if isequal(flag_mask_a,0) || ~isequal(nbslice_a,nbslice_mask)
     
    40684038else
    40694039mask_displ='no mask'; %default
    4070 filebase=get(handles.displ_filebase,'String');
     4040filebase=get(handles.RootName,'String');
    40714041[nbslice, flag_mask]=get_mask(filebase,handles);
    40724042if isequal(flag_mask,1)
    40734043      mask_displ=[num2str(nbslice) 'mask'];
    40744044elseif get(handles.compare,'Value')>1 & ~isequal(mask_displ,'no mask')% look for the second mask series
    4075         filebase_a=get(handles.displ_filebase2,'String');
     4045        filebase_a=get(handles.RootName_1,'String');
    40764046        [nbslice_a, flag_mask_a]=get_mask(filebase_a,handles);
    40774047        if isequal(flag_mask_a,0) | ~isequal(nbslice_a,nbslice)
     
    41124082else
    41134083mask_displ='no mask'; %default
    4114 filebase=get(handles.displ_filebase,'String');
     4084filebase=get(handles.RootName,'String');
    41154085[nbslice, flag_mask]=get_mask(filebase,handles);
    41164086if isequal(flag_mask,1)
    41174087      mask_displ=[num2str(nbslice) 'mask'];
    41184088elseif get(handles.compare,'Value')>1 & ~isequal(mask_displ,'no mask')% look for the second mask series
    4119         filebase_a=get(handles.displ_filebase2,'String');
     4089        filebase_a=get(handles.RootName_1,'String');
    41204090        [nbslice_a, flag_mask_a]=get_mask(filebase_a,handles);
    41214091        if isequal(flag_mask_a,0) | ~isequal(nbslice_a,nbslice)
     
    41534123else
    41544124    mask_displ='no mask'; %default
    4155     filebase=get(handles.displ_filebase,'String');
     4125    filebase=get(handles.RootName,'String');
    41564126    [nbslice, flag_mask]=get_mask(filebase,handles);
    41574127    if isequal(flag_mask,1)
    41584128          mask_displ=[num2str(nbslice) 'mask'];
    41594129    elseif get(handles.compare,'Value')>1 & ~isequal(mask_displ,'no mask')% look for the second mask series
    4160             filebase_a=get(handles.displ_filebase2,'String');
     4130            filebase_a=get(handles.RootName_1,'String');
    41614131            [nbslice_a, flag_mask_a]=get_mask(filebase_a,handles);
    41624132            if isequal(flag_mask_a,0) | ~isequal(nbslice_a,nbslice)
     
    43254295testgrid=0;
    43264296if value
    4327         filebase=get(handles.displ_filebase,'String');
     4297        filebase=get(handles.RootName,'String');
    43284298    [nbslice, flag_grid]=get_grid(filebase,handles);
    43294299    if isequal(flag_grid,1)
     
    43754345value=get(handles.browse_gridciv2,'Value');
    43764346if value
    4377         filebase=get(handles.displ_filebase,'String');
     4347        filebase=get(handles.RootName,'String');
    43784348    [nbslice, flag_grid]=get_grid(filebase,handles);
    43794349    if isequal(flag_grid,1)
     
    44124382% function browse_gridciv2_Callback(hObject, eventdata, handles)
    44134383%
    4414 % filebase=get(handles.displ_filebase,'String');
     4384% filebase=get(handles.RootName,'String');
    44154385% [FileName, PathName, filterindex] = uigetfile( ...
    44164386%        {'*.grid', ' (*.grid)';
     
    44304400% handles    structure with handles and user data (see GUIDATA)
    44314401
    4432 filebase=get(handles.displ_filebase,'String');
     4402filebase=get(handles.RootName,'String');
    44334403[FileName, PathName, filterindex] = uigetfile( ...
    44344404       {'*.grid', ' (*.grid)';
     
    46214591        set(handles.subdir_civ2,'Visible','off')
    46224592        set(handles.subdir_civ2_text,'Visible','off')
     4593        set(handles.dt_unit_civ2,'Visible','off')
     4594        set(handles.ref_i_civ2,'Visible','off')
     4595        set(handles.i_ref_civ2_title,'Visible','off')
     4596        set(handles.j_ref_civ2_title,'Visible','off')
     4597        set(handles.ref_j_civ2,'Visible','off')
    46234598    end
    46244599else
     
    46264601    set(handles.subdir_civ2,'Visible','on')
    46274602    set(handles.subdir_civ2_text,'Visible','on')
    4628 end
     4603    set(handles.dt_unit_civ2,'Visible','on')
     4604    set(handles.ref_i_civ2,'Visible','on')
     4605    set(handles.i_ref_civ2_title,'Visible','on')
     4606    set(handles.j_ref_civ2_title,'Visible','on')
     4607    set(handles.ref_j_civ2,'Visible','on')
     4608end
     4609set(handles.rho_civ2_title,'Visible',state)
    46294610
    46304611%------------------------------------------------------------------------
     
    47254706set(handles.list_pair_civ1,'Visible',state)
    47264707set(handles.PAIR_txt,'Visible',state)
    4727 %set(handles.dt_display_txt,'Visible',state)
    4728 set(handles.dt_unit,'Visible',state)
     4708%set(handles.dt_unit,'Visible',state)
    47294709set(handles.PAIR_frame,'Visible',state)
    47304710
     
    47894769 par.npx=num2str(sizim(2));
    47904770 par.npy=num2str(sizim(1));
    4791  time=get(handles.displ_filebase,'UserData'); %get the set of times
     4771 time=get(handles.RootName,'UserData'); %get the set of times
    47924772 par.gridname=get(handles.grid_civ1,'String');
    47934773 par.gridflag='y';
     
    48294809par.npx=num2str(sizim(2));
    48304810par.npy=num2str(sizim(1));
    4831 time=get(handles.displ_filebase,'UserData'); %get the set of times
     4811time=get(handles.RootName,'UserData'); %get the set of times
    48324812par.gridname=get(handles.grid_civ2,'String');
    48334813par.gridflag='y';
     
    51305110
    51315111%------------------------------------------------------------------------
     5112function ref_i_civ2_Callback(hObject, eventdata, handles)
     5113%------------------------------------------------------------------------
     5114mode_list=get(handles.mode,'String');
     5115mode_value=get(handles.mode,'Value');
     5116mode=mode_list{mode_value};
     5117find_netcpair_civ2(hObject, eventdata, handles);% update the menu of pairs depending on the available netcdf files
     5118
     5119%------------------------------------------------------------------------
     5120function ref_j_civ2_Callback(hObject, eventdata, handles)
     5121%------------------------------------------------------------------------
     5122mode_list=get(handles.mode,'String');
     5123mode_value=get(handles.mode,'Value');
     5124mode=mode_list{mode_value};
     5125if  isequal(mode,'series(Dj)')
     5126    find_netcpair_civ2(hObject, eventdata, handles);% update the menu of pairs depending on the available netcdf files
     5127end
     5128
     5129%------------------------------------------------------------------------
    51325130% --- Executes on button press in compare.
    51335131function compare_Callback(hObject, eventdata, handles)
     
    51355133test=get(handles.compare,'Value');
    51365134if test==2 || test==3   
    5137     filebase=get(handles.displ_filebase,'String');
     5135    filebase=get(handles.RootName,'String');
    51385136    browse=get(handles.browse_root,'Userdata');
    51395137    browse.nom_type_ima1=browse.nom_type_ima;
    51405138    set(handles.browse_root,'UserData',browse);
    51415139    set(handles.sub_txt,'Visible','on')
    5142     set(handles.displ_filebase2,'Visible','On');%mkes the second file input window visible
     5140    set(handles.RootName_1,'Visible','On');%mkes the second file input window visible
    51435141    mode_store=get(handles.mode,'String');%get the present 'mode'
    51445142    set(handles.compare,'UserData',mode_store);%store the mode display 
     
    51535151    ind_opening=1;%default
    51545152    browse.incr_pair=[0 0]; %default
    5155     oldfile=get(handles.displ_filebase,'String');
     5153    oldfile=get(handles.RootName,'String');
    51565154    menu={'*.xml;*.avi;*.AVI;*.nc','(*.xml,*.avi,*.nc)'; ...
    51575155            '*.xml', '.xml files';'*.avi;*.AVI', '.avi files';'*.nc', '.nc files';...
     
    51675165        return
    51685166    end
    5169     set(handles.displ_filebase2,'String',name);
     5167    set(handles.RootName_1,'String',name);
    51705168    [RootPath,RootFile,field_count,str2,str_a,str_b,xx,nom_type,subdir]=name2display(name);
    51715169    browse=get(handles.browse_root,'UserData');
     
    51745172   
    51755173    %check image extension
    5176     if ~strcmp(ext,get(handles.ext_ima,'String'))
     5174    if ~strcmp(ext,get(handles.ImaExt,'String'))
    51775175        msgbox_uvmat('ERROR','The two  input image series must have the same extenion name')
    51785176        return
     
    51815179    %check image size
    51825180    A=imread(fileinput);
    5183     npxy=get(handles.ext_ima,'UserData');
     5181    npxy=get(handles.ImaExt,'UserData');
    51845182    if ~isequal(npxy(1),size(A,1))|| ~isequal(npxy(2),size(A,2))
    51855183        msgbox_uvmat('ERROR','The two input image series must have the same size')
     
    51885186else
    51895187    set(handles.mode,'Visible','on')
    5190     set(handles.displ_filebase2,'Visible','Off');
     5188    set(handles.RootName_1,'Visible','Off');
    51915189    set(handles.sub_txt,'Visible','off')
    5192     set(handles.displ_filebase2,'String',[]);
     5190    set(handles.RootName_1,'String',[]);
    51935191    mode_store=get(handles.compare,'UserData');
    51945192    set(handles.mode,'String',mode_store)
     
    52025200function get_ref_fix1_Callback(hObject, eventdata, handles)
    52035201%------------------------------------------------------------------------
    5204 filebase=get(handles.displ_filebase,'String');
     5202filebase=get(handles.RootName,'String');
    52055203[FileName, PathName, filterindex] = uigetfile( ...
    52065204       {'*.nc', ' (*.nc)';
     
    52475245%------------------------------------------------------------------------
    52485246if isequal(get(handles.get_ref_fix2,'Value'),1)
    5249     filebase=get(handles.displ_filebase,'String');
     5247    filebase=get(handles.RootName,'String');
    52505248    [FileName, PathName, filterindex] = uigetfile( ...
    52515249           {'*.nc', ' (*.nc)';
     
    53695367end
    53705368
     5369
     5370
     5371
  • trunk/src/civ_3D.m

    r42 r71  
    2222function varargout = civ_3D(varargin)
    2323
    24 % Last Modified by GUIDE v2.5 25-Feb-2009 23:14:16
     24% Last Modified by GUIDE v2.5 26-Mar-2010 22:51:31
    2525% Begin initialization code - DO NOT EDIT
    2626gui_Singleton = 1;
     
    234234set(handles.first_i,'String',num2str(num_ref_i));
    235235set(handles.last_i,'String',num2str(num_ref_i));
    236 set(handles.first_j,'String',num2str(num_ref_j));
    237 set(handles.last_j,'String',num2str(num_ref_j));
    238236set(handles.ref_i,'String',num2str(num_ref_i));
    239 set(handles.ref_j,'String',num2str(num_ref_j));
    240237set(handles.browse_root,'UserData',browse);
    241238if ~isempty(varargin)% the interface is opened from uvmat
     
    381378    set(handles.ref_i,'String',num2str(ref_i));
    382379end
    383 if isempty(str2num(str_a))
    384     set(handles.ref_j,'String','1');
    385 else
    386     ref_j=str2num(str_a);
    387     if ~isempty(str2num(str_b))
    388         ref_j=floor((str2num(str_a)+str2num(str_b))/2);
    389         browse.incr_pair(2)=str2num(str_b)-str2num(str_a);
    390     end
    391     set(handles.first_j,'String',num2str(ref_j));
    392     set(handles.last_j,'String',num2str(ref_j));
    393     set(handles.ref_j,'String',num2str(ref_j));
    394 end;
    395380if isequal(ind_opening,1)
    396381    set(handles.CIV1,'Value',1)
     
    470455    last_i=first_i;  %default last_i
    471456end
    472 first_j=str2num(get(handles.first_j,'String'));
    473 if isempty(first_j)| first_j < 1
    474     first_j=1; %default first_j
    475 end
    476 last_j=str2num(get(handles.last_j,'String'));
    477 if isempty(last_j)| last_j < first_j
    478     last_j=first_j; %default last_j
    479 end
     457
    480458incr_i=str2num(get(handles.incr_i,'String'));
    481459if isempty(incr_i) | incr_i < 1;
    482460    set(handles.incr_i,'String','1') %default incr_i
    483 end
    484 incr_j=str2num(get(handles.incr_j,'String'));
    485 if isempty(incr_j) | incr_j < 1;
    486     set(handles.incr_j,'String','1') %default incr_j
    487461end
    488462dt=[];%default
     
    514488%%%%%%%%   read image documentation file  %%%%%%%%%%%%%%%%%%%%%%%%%%%
    515489    mode=''; %default
    516     %read the image documentation file if found
    517 if  isequal(ext,'.xml')
    518     set(handles.ref_i,'Visible','On')%use a reference index
    519     set(handles.ref_j,'Visible','On')
    520     set(handles.dt,'Visible','Off')
    521     set(handles.dt_text,'String','ref. ind.')
    522 elseif isequal(ext,'.avi') | isequal(ext,'.AVI')
    523     set(handles.ref_j,'Visible','Off')
    524     set(handles.dt,'Visible','Off')
    525     set(handles.dt_text,'String','ref. ind.')
    526 else
    527     set(handles.ref_i,'Visible','Off')
    528     set(handles.ref_j,'Visible','Off')
    529     set(handles.dt,'Visible','On')
    530     set(handles.dt_text,'String','dt(ms)=')
    531 end
    532 
    533490if isequal(ext,'.xml')
    534     [XmlData,warntext]=imadoc2struct([filebase '.xml']);
     491    [XmlData,warntext]=imadoc2struct([filebase '.xml'])
    535492        if isfield(XmlData,'Heading')&&isfield(XmlData.Heading','ImageName')
    536493            [PP,FF,fc,str2,str_a,str_b,ext_ima_read,nom_type_read]=name2display(XmlData.Heading.ImageName);
    537494        end
    538         if isfield(XmlData,'Camera')
    539             if isfield(XmlData.Camera,'TimeUnit')
    540                 TimeUnit=XmlData.Camera.TimeUnit;
    541             end
    542             if isfield(XmlData.Camera,'ImageSize')
    543                ImageSize=XmlData.Camera.ImageSize;
    544                if ~isempty(ImageSize)&& ~isempty(ImageSize)
    545                    xindex=findstr(ImageSize,'x');
    546                    if length(xindex)>=2
    547                         npx=str2num(ImageSize(1:xindex(1)-1));
    548                         npy=str2num(ImageSize(xindex(1)+1:xindex(2)-1));
    549                    end
    550                end
    551            end
     495        if isfield(XmlData,'TimeUnit')
     496                TimeUnit=XmlData.TimeUnit;
     497        end
     498        if isfield(XmlData,'Npx')&&isfield(XmlData,'Npy')
     499            set(handles.npx,'String',num2str(XmlData.Npx));
     500            set(handles.npy,'String',num2str(XmlData.Npy));
     501        end
     502        if isfield(XmlData,'Time')&&~isempty(XmlData.Time)
     503            time=XmlData.Time;
     504            set(handles.npz,'String',num2str(size(time,2)));
    552505        end
    553506        pxcmx_search=1;
     
    641594  last_j=1;
    642595end
     596UvData.XmlData=XmlData;
     597
    643598if exist('time','var')
    644     siztime=size(time);
    645     nbfield=siztime(1);
    646     nbfield2=siztime(2);
     599    nbfield=size(time,1);
    647600    set(handles.displ_filebase,'UserData',time); %store the set of times
    648     set(handles.dt_unit,'String',['m' TimeUnit]);
    649601    set(handles.TimeUnit,'String',TimeUnit);
    650602    set(handles.nb_field,'String',num2str(nbfield));
    651     set(handles.nb_field2,'String',num2str(nbfield2));
    652603end
    653604set(handles.CoordUnit,'String',[CoordUnit '/'])
    654 set(handles.pxcmx,'String',num2str(pxcmx));
    655 set(handles.pxcmy,'String',num2str(pxcmy));
    656605if isempty(pxcmx_search)
    657606   set(handles.calcul_search,'UserData',[pxcmx pxcmy]);
     
    659608   set(handles.calcul_search,'UserData',[pxcmx_search pxcmy_search]);
    660609end
    661 set(handles.pxcmx,'UserData',npx);
    662 set(handles.pxcmy,'UserData',npy);
    663610set(handles.first_i,'String',num2str(first_i));
    664611set(handles.last_i,'String',num2str(last_i));%
    665 set(handles.first_j,'String',num2str(first_j));
    666 set(handles.last_j,'String',num2str(last_j));%
    667612browse.ext_ima=ext_ima;
    668613browse.nom_type_ima=nom_type_ima;
     
    830775     set(handles.nb_field,'Visible','On')
    831776     set(handles.ref_i,'Visible','On')
    832      if nbfield2 > 1
    833         set(handles.jtext,'Visible','On')
    834         set(handles.first_j,'Visible','On')
    835         set(handles.last_j,'Visible','On')
    836         set(handles.incr_j,'Visible','On')
    837         set(handles.nb_field2,'Visible','On')
    838         set(handles.ref_j,'Visible','On')
    839      else
    840         set(handles.jtext,'Visible','Off')
    841         set(handles.first_j,'Visible','Off')
    842         set(handles.last_j,'Visible','Off')
    843         set(handles.incr_j,'Visible','Off')
    844         set(handles.nb_field2,'Visible','Off')
    845         set(handles.ref_j,'Visible','Off')
    846     end
    847777elseif isequal(mode,'displacement')%the pairs have the same indices
    848778     displ_num(1,1)=0;
     
    939869end
    940870ref_i=str2num(get(handles.ref_i,'String'));
    941 if isequal(mode,'pair j1-j2')|isequal(mode,'st_pair j1-j2')
    942     ref_j=0;
    943 else
    944     ref_j=str2num(get(handles.ref_j,'String'));
    945 end
    946 if isequal(get(handles.dt_text,'String'),'dt(ms)=')%simple series(Di) with equal interval
    947     ref_i=floor((first_i+last_i)/2);
    948     ref_j=1;
    949 end
    950871time=get(handles.displ_filebase,'UserData');%get the set of times
    951872if isempty(time)
    952873    time=[0 1];
    953874end
    954 dt_unit=str2num(get(handles.dt,'String'));% used when there is no image documentation file
    955875displ_num=get(handles.list_pair_civ1,'UserData');
    956876
     
    1006926    end
    1007927end
    1008 if isequal(mode,'series(Di)') | isequal(mode,'st_series(Di)')
     928if isequal(mode,'series(Di)')
    1009929    if testpair
    1010930              displ_pair{1}=['Di= ' num2str(-floor(browse.incr_pair(1)/2)) '|' num2str(ceil(browse.incr_pair(1)/2))];       
    1011     elseif ~isequal(get(handles.dt_text,'String'),'dt(ms)=')
     931    else
    1012932       for ipair=1:nbpair
    1013933          if select(ipair)         
    1014               dt=time(ref_i+displ_num(4,ipair),ref_j+displ_num(2,ipair))-time(ref_i+displ_num(3,ipair),ref_j+displ_num(1,ipair));%time interval dt
     934              dt=time(ref_i+displ_num(4,ipair),1)-time(ref_i+displ_num(3,ipair),1);%time interval dt
    1015935              displ_pair{ipair}=['Di= ' num2str(-floor(ipair/2)) '|' num2str(ceil(ipair/2)) ' :dt= ' num2str(dt*1000)];
    1016936          else
     
    1018938          end
    1019939       end
    1020     else
    1021        for ipair=1:nbpair
    1022          if select(ipair)
    1023             displ_pair{ipair}=['Di= ' num2str(-floor(ipair/2)) '|' num2str(ceil(ipair/2)) ' :dt= ' num2str(dt_unit*ipair)];
    1024          else
    1025             displ_pair{ipair}='...'; %pair not displayed in the menu
    1026          end
    1027        end
    1028     end
    1029 elseif isequal(mode,'series(Dj)')|isequal(mode,'st_series(Dj)')% series on the j index
    1030     if testpair
    1031          displ_pair{1}=['Dj= ' num2str(-floor(browse.incr_pair(1)/2)) '|' num2str(ceil(browse.incr_pair(1)/2))];
    1032     else
    1033        for ipair=1:nbpair
    1034           if select(ipair)
    1035               dt=time(ref_i+displ_num(4,ipair),ref_j+displ_num(2,ipair))-time(ref_i+displ_num(3,ipair),ref_j+displ_num(1,ipair));%time interval dt
    1036               displ_pair{ipair}=['Dj= ' num2str(-floor(ipair/2)) '|' num2str(ceil(ipair/2)) ' :dt= ' num2str(dt*1000)];
    1037            elseif testpair
    1038               displ_pair{1}=['Dj= ' num2str(-floor(browse.incr_pair(2)/2)) '|' num2str(ceil(browse.incr_pair(2)/2))];
    1039           else
    1040              displ_pair{ipair}='...'; %pair not displayed in the menu
    1041           end
    1042        end
    1043    end
    1044 elseif isequal(mode,'pair j1-j2')|isequal(mode,'st_pair j1-j2')%case of pairs
     940    end
     941elseif isequal(mode,'pair j1-j2')%case of pairs
    1045942    for ipair=1:nbpair
    1046943        if select(ipair)
     
    1073970%--------------------------------------------------------------
    1074971function find_netcpair_civ2(hObject, eventdata, handles)
     972return %do not exist in 3D
    1075973set(gcf,'Pointer','watch')
    1076974%nomenclature types
     
    11241022    ref_j=str2num(get(handles.ref_j,'String'));
    11251023end
    1126 if isequal(get(handles.dt_text,'String'),'dt(ms)=')%simple series(Di) with equal interval
    1127     ref_i=ceil((first_i+last_i)/2);
    1128     ref_j=1;
    1129 end
    1130 %     ref_i=browse.num_ref;%field number initially selected by the browser
    11311024time=get(handles.displ_filebase,'UserData'); %get the set of times
    11321025if isempty(time)
     
    11851078end
    11861079if isequal(mode,'series(Di)')  | isequal(mode,'st_series(Di)')
    1187     if  ~isequal(get(handles.dt_text,'String'),'dt(ms)=')
     1080    if  ~isequal(get(handles.ext_txt,'String'),'dt(ms)=')
    11881081       for ipair=1:nbpair
    11891082          if select(ipair)
     
    12401133last_i=str2num(get(handles.last_i,'String'));
    12411134incr=str2num(get(handles.incr_i,'String'));
    1242 first_j=str2num(get(handles.first_j,'String'));
    1243 last_j=str2num(get(handles.last_j,'String'));
    1244 incr_j=str2num(get(handles.incr_j,'String'));
    12451135list_civ1=get(handles.list_pair_civ1,'String');
    12461136index_civ1=get(handles.list_pair_civ1,'Value');
     
    12491139index_civ2=get(handles.list_pair_civ2,'Value');
    12501140str_civ2=list_civ2{index_civ2};
    1251 if isequal(first_i,[])|isequal(first_j,[]), errordlg('first field number not defined'),...
     1141if isempty(first_i), msgbox_uvmat('ERROR','first field number not defined'),...
    12521142    set(handles.RUN, 'Enable','On'), set(handles.RUN,'BackgroundColor',[1 0 0]),return,end;
    1253 if isequal(last_i,[])| isequal(last_j,[]),errordlg('last field number not defined'),...
     1143if isempty(last_i),msgbox_uvmat('ERROR','last field number not defined'),...
    12541144    set(handles.RUN, 'Enable','On'), set(handles.RUN,'BackgroundColor',[1 0 0]),return,end;
    1255 if isequal(incr,[])| isequal(incr_j,[]),errordlg('increment in field number not defined'),...
     1145if isempty(incr), msgbox_uvmat('ERROR','increment in field number not defined'),...
    12561146    set(handles.RUN, 'Enable','On'), set(handles.RUN,'BackgroundColor',[1 0 0]),return,end;
    1257 if last_i < first_i | last_j < first_j , errordlg('last field number must be larger than the first one'),...
     1147if last_i < first_i , msgbox_uvmat('ERROR','last field number must be larger than the first one'),...
    12581148    set(handles.RUN, 'Enable','On'), set(handles.RUN,'BackgroundColor',[1 0 0]),return,end;
    12591149num1=[first_i:incr:last_i];
    1260 num_j=[first_j:incr_j:last_j];
    1261 if isequal (mode,'series(Di)') |isequal(mode,'st_series(Di)')
     1150if isequal (mode,'series(Di)')
    12621151     %recognize the pair civ1 from the display
    12631152        indsel=find((double(str_civ1)<48)|(double(str_civ1)>57));% character indices of non numerical characters
     
    12731162    num1_civ1=num1-d1;% set of first image numbers
    12741163    num2_civ1=num1+d2;
    1275     num_a_civ1=num_j;
    1276     num_b_civ1=num_j;
     1164    num_a_civ1=1;
     1165    num_b_civ1=1;
    12771166    num1_civ2=num1-floor(index_civ2/2)*ones(size(num1));% set of first image numbers
    12781167    num2_civ2=num1+ceil(index_civ2/2)*ones(size(num1));
    12791168    num1_civ2=num1-d1;% set of first image numbers
    12801169    num2_civ2=num1+d2;
    1281     num_a_civ2=num_j;
    1282     num_b_civ2=num_j;
     1170    num_a_civ2=1;
     1171    num_b_civ2=1;
    12831172    % adjust the first and last field number
    12841173    lastfield=str2num(get(handles.nb_field,'String'));
     
    14391328global civ1_exe civ2_exe patch_exe patch_new_exe fix_exe todo_path sge Civ_exe
    14401329
    1441 pxcmx=get(handles.pxcmx,'String');
    1442 pxcmy=get(handles.pxcmy,'String');
    1443 npx=get(handles.pxcmx,'UserData');
    1444 npy=get(handles.pxcmy,'UserData');
     1330% pxcmx=get(handles.pxcmx,'String');
     1331% pxcmy=get(handles.pxcmy,'String');
     1332% npx=get(handles.pxcmx,'UserData');
     1333% npy=get(handles.pxcmy,'UserData');
    14451334
    14461335%check the list of operations:
     
    14891378path_uvmat=which('uvmat');% check the path detected for source file uvmat
    14901379path_UVMAT=fileparts(path_uvmat); %path to UVMAT
    1491 if isunix
    1492     %fid = fopen(fullfile(path_UVMAT,'PARAM_LINUX.txt'),'r');%open the file with civ_3D binary names
    1493     xmlfile=fullfile(path_UVMAT,'PARAM_LINUX.xml');
    1494     if exist(xmlfile,'file')
    1495         t=xmltree(xmlfile);
    1496         sparam=convert(t);
    1497     end
    1498 else
    1499     %fid = fopen(fullfile(path_UVMAT,'PARAM_WIN.txt'),'r');%open the file with civ_3D binary names
    1500     xmlfile=fullfile(path_UVMAT,'PARAM_WIN.xml');
    1501     if exist(xmlfile,'file')
    1502         t=xmltree(xmlfile);
    1503         sparam=convert(t);
    1504     end
    1505 end
    1506  sge=0;
    1507 if isfield(sparam,'Civ_exe')
    1508     Civ_exe=sparam.Civ_exe
    1509 end
    1510 if isfield(sparam,'Civ1_exe')
    1511     civ1_exe=sparam.Civ1_exe
    1512 end
    1513 if isfield(sparam,'Civ2_exe')
    1514     civ2_exe=sparam.Civ2_exe
    1515 end
    1516 if isfield(sparam,'Patch_exe')
    1517     patch_exe=sparam.Patch_exe
    1518 end
    1519 if isfield(sparam,'PatchNew_exe')
    1520     patch_new_exe=sparam.PatchNew_exe
    1521 end
    1522 if isfield(sparam,'Fix_exe')
    1523     fix_exe=sparam.Fix_exe
    1524 end
    1525 if isfield(sparam,'Todo_path')
    1526     todo_path=sparam.Todo_path
    1527 end
    1528 if isfield(sparam,'SGE')
    1529     sge=str2num(sparam.SGE)
    1530 end
     1380%fid = fopen(fullfile(path_UVMAT,'PARAM_LINUX.txt'),'r');%open the file with civ_3D binary names
     1381xmlfile=fullfile(path_UVMAT,'PARAM.xml');
     1382if exist(xmlfile,'file')
     1383    t=xmltree(xmlfile);
     1384    sparam=convert(t);
     1385end
     1386if isfield(sparam.BatchParam,'Civ3D3CBin')
     1387    Civ3D3CBin=sparam.BatchParam.Civ3D3CBin;
     1388else
     1389    msgbox_uvmat('ERROR','binary for CIV3D3C not defined in PARAM.xml')
     1390    return
     1391end
     1392 
    15311393%choice of batch priority
    15321394ind_answer=2;
    1533 if sge
     1395% if sge
    15341396    [s,w]=unix('qstat -q civ_3D.q|grep job_| wc -l'); %check the waiting list (command unix)
    15351397    if isequal(s,0)
     
    15471409        return
    15481410    end
    1549 end
     1411% end
    15501412%initialize the waitbars
    15511413set(handles.waitbar_1,'Position',[0.946 0.876 0.03 0.001])
     
    16351497%           for j=1:nbslice
    16361498              filename=name_generator(filebase,num1_civ1(ifile),[],'.nc',...
    1637                 nom_type_nc,1,num2_civ1(ifile),[],subdir_civ1);%
     1499                '_i1-i2',1,num2_civ1(ifile),[],subdir_civ1);%
    16381500            detect=exist(filename,'file')
    16391501              if detect% if a netcdf file already exists
     
    16571519%get image names
    16581520for ifile=1:nbfield
    1659     filecell_ima1_civ1{ifile}=name_generator(filebase, num1_civ1(ifile),[],ext_ima,nom_type_ima);%first image
    1660     filecell_ima2_civ1{ifile}=name_generator(filebase, num2_civ1(ifile),[],ext_ima,nom_type_ima); %second image
     1521    filecell_ima1_civ1{ifile}=name_generator(filebase, num1_civ1(ifile),[],'.vol','_i');%first image
     1522    filecell_ima2_civ1{ifile}=name_generator(filebase, num2_civ1(ifile),[],'.vol','_i'); %second image
    16611523     if ~exist(filecell_ima1_civ1{ifile},'file')
    16621524            msgbox_uvmat('ERROR',[filecell_ima1_civ1{ifile} ' not found'])
     
    16841546set(handles.browse_root,'UserData',browse);%update the nomenclature type for uvmat
    16851547
    1686 %COPY IMAGES TO THE FORMAT .vol IF NEEDED
    1687 if isequal(nom_type_ima,'avi')
    1688     nom_type_imanew='_i';
    1689 else
    1690     nom_type_imanew=nom_type_ima;
    1691 end
    1692 
    1693 if ~isequal(ext_ima,'.vol')
    1694     if box_test(1)==1 %if civ1 is performed
    1695        h = waitbar(0,['copy images to the .png format for civ1']);% display a wait bar
    1696        for ifile=1:nbfield
    1697             waitbar(ifile/nbfield);
    1698             Atot=[];
    1699             filename_A=name_generator(filebase,num1_civ1(ifile),1,'.png','_i');%A VOIR
    1700             idetect_cur=exist(filename_A,'file');
    1701             for j=1:nbslice
    1702                     if idetect_cur==0
    1703                         A=read_image(cell2mat(filecell_ima1_civ1(ifile,j)),nom_type_ima2,npx,npy,num1_civ1(ifile));
    1704                         Atot=[Atot;A];
    1705                         %imwrite(A,filename,'BitDepth',16);
    1706                     end
    1707             end
    1708             imwrite(Atot,filename_A,'BitDepth',16);
    1709                     %filecell_ima1_civ1(ifile,j)={filename};
    1710             Atot=[];
    1711             filename_B=name_generator(filebase, num2_civ1(ifile),1,'.png','_i');
    1712             idetect_cur=exist(filename_B,'file');
    1713             for j=1:nbslice
    1714                     if idetect_cur==0
    1715                         A=read_image(cell2mat(filecell_ima2_civ1(ifile,j)),nom_type_ima2,npx,npy,num2_civ1(ifile));
    1716                         Atot=[Atot;A];
    1717 %                         imwrite(A,filename,'BitDepth',16);
    1718                     end
    1719                     %filecell_ima2_civ1(ifile,j)={filename};
    1720             end
    1721             imwrite(Atot,filename_B,'BitDepth',16);
    1722         end
    1723         close(h)
    1724     end   
    1725 end
    1726 
    1727 if ~sge     
    1728     %OPEN THE WAIT LIST FOR BATCH PROCESSES
    1729     name_lock=fullfile(todo_path,'lock'); %lock file
    1730     iwait=0;
    1731     while(exist(name_lock) & iwait<15)
    1732         pause(1); %wait 1 second
    1733         iwait=iwait+1;
    1734     end
    1735     if iwait==15
    1736         errordlg(['I''m tired to wait for the lock file, please delete it then click again on BATCH' name_lock ])
    1737         set(handles.BATCH, 'Enable','On')
    1738         set(handles.BATCH,'BackgroundColor',[1 0 0])
    1739         return
    1740     end
    1741     p0=fopen(name_lock,'w'); %create the file name_lock: prevents other users to interfere
    1742     name_todo=fullfile(todo_path,'TODO.txt');
    1743     p1=fopen(name_todo,'a');
    1744     if (p1<0)
    1745         errordlg(['error in opening ' name_todo])
    1746         set(handles.BATCH, 'Enable','On')
    1747         set(handles.BATCH,'BackgroundColor',[1 0 0])
    1748         return;
    1749     end
    1750 end
    1751 'TESTciv3D'
    1752 nbfield
    17531548for ifile=1:nbfield
    17541549    i_cmd=0;
     
    17701565        [par_civ1.path,resu_file,resu_ext]=fileparts(filecell_nc1{ifile});
    17711566        par_civ1.volume1=filecell_ima1_civ1{ifile};
    1772         par_civ1.volume2=filecell_ima2_civ1{ifile}
    1773         par_civ1.nx=1024;
    1774         par_civ1.ny=1024;
     1567        par_civ1.volume2=filecell_ima2_civ1{ifile};
     1568        par_civ1.nx=str2double(get(handles.npx,'String'));
     1569        par_civ1.ny=str2double(get(handles.npy,'String'));;
    17751570        par_civ1.nz=par_civ1.gridLimits_Zmax - par_civ1.gridLimits_Zmin;
    17761571        'TEST'
     
    17821577    %    save(civAllxml)
    17831578        par_civ1_3d_xml=fullfile(par_civ1.path,[resu_file '.xml']);%[par_civ1.path '/test_to_change.xml'];
    1784          pvalue=num2str((1-ind_answer)*500);
     1579         pvalue=num2str((1-ind_answer)*500)
    17851580        save(civAllxml,par_civ1_3d_xml);
    1786       if(isunix && sge)
    1787          ['echo /CIVX/bin/MPI/lam-7.1.3_g95/bin/mpirun C  /CIVX/bin/civ3d3c -p ' par_civ1_3d_xml '|qsub -p ' pvalue ' -q lam.q -pe lam_loose 16 -e ' par_civ1_3d_xml '.errors -o ' par_civ1_3d_xml '.log' ]
    1788          eval ( ['!echo /CIVX/bin/MPI/lam-7.1.3_g95/bin/mpirun C  /CIVX/bin/civ3d3c -p ' par_civ1_3d_xml '|qsub -p ' pvalue ' -q lam.q -pe lam_loose 16 -e ' par_civ1_3d_xml '.errors -o ' par_civ1_3d_xml '.log' ])
    1789       else
    1790             '3D mode is NOT supported without sge'
    1791       end
    1792          return
     1581   
     1582%       if(isunix && sge)
     1583         ['echo /CIVX/bin/MPI/lam-7.1.3_g95/bin/mpirun C  ' Civ3D3CBin ' -p ' par_civ1_3d_xml '|qsub -p ' pvalue ' -q lam.q -pe lam_loose 16 -e ' par_civ1_3d_xml '.errors -o ' par_civ1_3d_xml '.log' ]
     1584         eval ( ['!echo /CIVX/bin/MPI/lam-7.1.3_g95/bin/mpirun C  ' Civ3D3CBin ' -p ' par_civ1_3d_xml '|qsub -p ' pvalue ' -q lam.q -pe lam_loose 16 -e ' par_civ1_3d_xml '.errors -o ' par_civ1_3d_xml '.log' ])
     1585%       else
     1586%           '3D mode is NOT supported without sge'
     1587%       end
     1588     return
    17931589        % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    17941590        %  fichier xml produit
     
    27232519par.gridSpacing_Z=get(handles.dz_civ1,'String');
    27242520% Zmin=str2num(get(handles.first_j,'String'))-1;
    2725 Zmax=str2num(get(handles.nb_field2,'String'));
     2521Zmax=str2num(get(handles.npz,'String'));
    27262522par.gridLimits_Xmin=0;
    27272523par.gridLimits_Ymin=0;
     
    27292525% A=imread(file_ima);%read the first image to get the size
    27302526%sizim=size(A);
    2731 par.gridLimits_Xmax=1024;%num2str(sizim(2));
    2732 par.gridLimits_Ymax=1024;%num2str(sizim(1));
     2527par.gridLimits_Xmax=str2double(get(handles.npx,'String'));%num2str(sizim(2));
     2528par.gridLimits_Ymax=str2double(get(handles.npy,'String'));%num2str(sizim(1));
    27332529par.gridLimits_Zmax=Zmax;
    27342530par.grid='grille';
     
    33013097
    33023098
    3303 
    3304 function edit75_Callback(hObject, eventdata, handles)
    3305 % hObject    handle to edit75 (see GCBO)
    3306 % eventdata  reserved - to be defined in a future version of MATLAB
    3307 % handles    structure with handles and user data (see GUIDATA)
    3308 
    3309 % Hints: get(hObject,'String') returns contents of edit75 as text
    3310 %        str2double(get(hObject,'String')) returns contents of edit75 as a double
    3311 
    3312 
    3313 % --- Executes during object creation, after setting all properties.
    3314 function edit75_CreateFcn(hObject, eventdata, handles)
    3315 % hObject    handle to edit75 (see GCBO)
    3316 % eventdata  reserved - to be defined in a future version of MATLAB
    3317 % handles    empty - handles not created until after all CreateFcns called
    3318 
    3319 % Hint: edit controls usually have a white background on Windows.
    3320 %       See ISPC and COMPUTER.
    3321 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    3322     set(hObject,'BackgroundColor','white');
    3323 end
    3324 
    3325 
    3326 
    33273099function dz_civ1_Callback(hObject, eventdata, handles)
    33283100% hObject    handle to dz_civ1 (see GCBO)
     
    33343106
    33353107
    3336 % --- Executes during object creation, after setting all properties.
    3337 function dz_civ1_CreateFcn(hObject, eventdata, handles)
    3338 % hObject    handle to dz_civ1 (see GCBO)
     3108function edit77_Callback(hObject, eventdata, handles)
     3109% hObject    handle to edit77 (see GCBO)
    33393110% eventdata  reserved - to be defined in a future version of MATLAB
    3340 % handles    empty - handles not created until after all CreateFcns called
    3341 
    3342 % Hint: edit controls usually have a white background on Windows.
    3343 %       See ISPC and COMPUTER.
    3344 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    3345     set(hObject,'BackgroundColor','white');
    3346 end
    3347 
    3348 
     3111% handles    structure with handles and user data (see GUIDATA)
     3112
     3113% Hints: get(hObject,'String') returns contents of edit77 as text
     3114%        str2double(get(hObject,'String')) returns contents of edit77 as a double
     3115
     3116
     3117
     3118function edit78_Callback(hObject, eventdata, handles)
     3119% hObject    handle to ref_i (see GCBO)
     3120% eventdata  reserved - to be defined in a future version of MATLAB
     3121% handles    structure with handles and user data (see GUIDATA)
     3122
     3123% Hints: get(hObject,'String') returns contents of ref_i as text
     3124%        str2double(get(hObject,'String')) returns contents of ref_i as a double
     3125
     3126
     3127function edit79_Callback(hObject, eventdata, handles)
     3128% hObject    handle to edit79 (see GCBO)
     3129% eventdata  reserved - to be defined in a future version of MATLAB
     3130% handles    structure with handles and user data (see GUIDATA)
     3131
     3132% Hints: get(hObject,'String') returns contents of edit79 as text
     3133%        str2double(get(hObject,'String')) returns contents of edit79 as a double
     3134
     3135
     3136
     3137function npz_Callback(hObject, eventdata, handles)
     3138% hObject    handle to npz (see GCBO)
     3139% eventdata  reserved - to be defined in a future version of MATLAB
     3140% handles    structure with handles and user data (see GUIDATA)
     3141
     3142% Hints: get(hObject,'String') returns contents of npz as text
     3143%        str2double(get(hObject,'String')) returns contents of npz as a double
     3144
     3145
     3146function npy_Callback(hObject, eventdata, handles)
     3147% hObject    handle to npy (see GCBO)
     3148% eventdata  reserved - to be defined in a future version of MATLAB
     3149% handles    structure with handles and user data (see GUIDATA)
     3150
     3151% Hints: get(hObject,'String') returns contents of npy as text
     3152%        str2double(get(hObject,'String')) returns contents of npy as a double
     3153
     3154
     3155
     3156
     3157function npx_Callback(hObject, eventdata, handles)
     3158% hObject    handle to npx (see GCBO)
     3159% eventdata  reserved - to be defined in a future version of MATLAB
     3160% handles    structure with handles and user data (see GUIDATA)
     3161
     3162% Hints: get(hObject,'String') returns contents of npx as text
     3163%        str2double(get(hObject,'String')) returns contents of npx as a double
     3164
     3165
     3166
     3167
  • trunk/src/delete_object.m

    r19 r71  
    77function delete_object(hObject)
    88
    9 huvmat=findobj('Name','uvmat');%handles of the uvmat interface
     9huvmat=findobj('tag','uvmat');%handles of the uvmat interface
    1010UvData=get(huvmat,'UserData');
    11 hlist_object=findobj(huvmat,'Tag','list_object');%handles of the object liçst in the uvmat interface
     11hlist_object=findobj(huvmat,'Tag','list_object_1');%handles of the object liçst in the uvmat interface
    1212list_str=get(hlist_object,'String');%objet list
    1313ObjectData=[];%default
     
    7272set(hlist_object,'String',list_str)
    7373set(hlist_object,'Value',length(list_str))
     74hlist_object=findobj(huvmat,'Tag','list_object_2');%handles of the object liçst in the uvmat interface
     75set(hlist_object,'String',[list_str {'...'}])
     76set(hlist_object,'Value',length(list_str)+1)
  • trunk/src/geometry_calib.m

    r69 r71  
    7878% Update handles structure
    7979guidata(hObject, handles);
    80 %movegui(hObject,'east');% position the GUI ton the right of the screen
    81 % if exist('handles_uvmat','var') %& isfield(data,'ParentButton')
    82       set(hObject,'DeleteFcn',{@closefcn})%
    83 % end
     80set(hObject,'DeleteFcn',{@closefcn})%
     81
    8482%set the position of the interface
    8583if exist('pos','var')& length(pos)>2
     
    10098    end   
    10199end
    102 set(handles.ListCoord,'String',{'...'})
     100set(handles.ListCoord,'String',{'......'})
    103101if exist(inputxml,'file')
    104102    loadfile(handles,inputxml)% load the point coordiantes existing in the xml file
     
    106104
    107105set(handles.ListCoord,'KeyPressFcn',{@key_press_fcn,handles})%set keyboard action function
    108 %set(hObject,'KeyPressFcn',{'keyboard_callback',handles})%set keyboard action function on uvmat interface when geometry_calib is on top
    109 %htable=uitable(10,5)
    110 %set(htable,'ColumnNames',{'x','y','z','X(pixels)','Y(pixels)'})
     106
    111107
    112108%------------------------------------------------------------------------
     
    214210    end
    215211end
    216 CoordCell=[CoordCell;{' ',' ',' ',' ',' '}];
     212% CoordCell=[CoordCell;{' ',' ',' ',' ',' '}];
    217213Tabchar=cell2tab(CoordCell,'    |    ');%transform cells into table ready for display
     214Tabchar=[Tabchar;{'......'}];
    218215set(handles.ListCoord,'Value',1)
    219216set(handles.ListCoord,'String',Tabchar)
     217MenuPlot_Callback(handles.geometry_calib, [], handles)
    220218
    221219%
     
    227225if ~isempty(huvmat)
    228226    handles=guidata(huvmat);
    229     set(handles.MenuTools,'enable','on')
     227    set(handles.MenuMask,'enable','on')
     228    set(handles.MenuGrid,'enable','on')
    230229    set(handles.MenuObject,'enable','on')
    231230    set(handles.MenuEdit,'enable','on')
     
    298297set(hhuvmat.FixedLimits,'BackgroundColor',[0.7 0.7 0.7])
    299298uvmat('RootPath_Callback',hObject,eventdata,hhuvmat); %file input with xml reading  in uvmat
    300 
     299MenuPlot_Callback(hObject, eventdata, handles)
    301300figure(handles.geometry_calib)
    302301
     
    450449% est_kc=[1;0;0;0;0];
    451450est_dist=[1;0;0;0;0];
    452 run('D:\PROG\MATLAB\TOOLBOX_calib\go_calib_optim');
     451run(fullfile(path_UVMAT,'TOOLBOX_calib','go_calib_optim'));
    453452
    454453GeometryCalib.CalibrationType='tsai';
     
    497496    sparam=convert(t);
    498497end
    499 if ~isfield(sparam,'GeometryCalib_exe')
    500     msgbox_uvmat('ERROR',['calibration program <GeometryCalib_exe> undefined in parameter file ' xmlfile])
     498if ~isfield(sparam,'GeometryCalibBin')
     499    msgbox_uvmat('ERROR',['calibration program <GeometryCalibBin> undefined in parameter file ' xmlfile])
    501500    return
    502501end
    503 Tsai_exe=sparam.GeometryCalib_exe;
     502Tsai_exe=sparam.GeometryCalibBin;
    504503if ~exist(Tsai_exe,'file')%the binary is defined in /bin, default setting
    505504     Tsai_exe=fullfile(path_UVMAT,Tsai_exe);
    506505end
    507506if ~exist(Tsai_exe,'file')
    508     msgbox_uvmat('ERROR',['calibration program ' sparam.GeometryCalib_exe ' defined in PARAM.xml does not exist'])
     507    msgbox_uvmat('ERROR',['calibration program ' sparam.GeometryCalibBin ' defined in PARAM.xml does not exist'])
    509508    return
    510509end
     
    643642ListCoord_Callback(hObject, eventdata, handles)
    644643MenuPlot_Callback(hObject, eventdata, handles)
     644
    645645%------------------------------------------------------------------------
    646646% --- Executes on selection change in ListCoord.
    647647function ListCoord_Callback(hObject, eventdata, handles)
    648648%------------------------------------------------------------------------
     649huvmat=findobj(allchild(0),'Name','uvmat');%find the current uvmat interface handle
     650hplot=findobj(huvmat,'Tag','axes3');%main plotting axis of uvmat
     651hhh=findobj(hplot,'Tag','calib_marker');
    649652Coord_cell=get(handles.ListCoord,'String');
    650653val=get(handles.ListCoord,'Value');
    651 if length(Coord_cell)>0
    652     coord_str=Coord_cell{val};
    653     k=findstr('|',coord_str);
    654     if isempty(k)
    655         return
    656     end
    657     set(handles.XObject,'String',coord_str(1:k(1)-5))
    658     set(handles.YObject,'String',coord_str(k(1)+5:k(2)-5))
    659     set(handles.ZObject,'String',coord_str(k(2)+5:k(3)-5))
    660     set(handles.XImage,'String',coord_str(k(3)+5:k(4)-5))
    661     set(handles.YImage,'String',coord_str(k(4)+5:end))
    662     huvmat=findobj(allchild(0),'Name','uvmat');%find the current uvmat interface handle
    663     hplot=findobj(huvmat,'Tag','axes3');%main plotting axis of uvmat
    664     h_menu_coord=findobj(huvmat,'Tag','menu_coord');
    665     menu=get(h_menu_coord,'String');
    666     choice=get(h_menu_coord,'Value');
    667     if iscell(menu)
    668         option=menu{choice};
    669     else
    670         option='px'; %default
    671     end
    672     if isequal(option,'phys')
    673         XCoord=str2num(coord_str(1:k(1)-5));
    674         YCoord=str2num(coord_str(k(1)+5:k(2)-5));
    675     elseif isequal(option,'px')|| isequal(option,'')
    676         XCoord=str2num(coord_str(k(3)+5:k(4)-5));
    677         YCoord=str2num(coord_str(k(4)+5:end));
    678     else
    679         msgbox_uvmat('ERROR','the choice in menu_coord of uvmat must be px or phys ')
    680     end
    681     huvmat=findobj(allchild(0),'Name','uvmat');%find the current uvmat interface handle
    682     hplot=findobj(huvmat,'Tag','axes3');%main plotting axis of uvmat
    683     hhh=findobj(hplot,'Tag','calib_marker');
    684     if isempty(hhh)
    685         axes(hplot)
    686         line(XCoord,YCoord,'Color','m','Tag','calib_marker','LineStyle','.','Marker','o','MarkerSize',20);
    687     else
    688         set(hhh,'XData',XCoord)
    689         set(hhh,'YData',YCoord)
    690     end
     654coord_str=Coord_cell{val};
     655k=findstr('|',coord_str);
     656if isempty(k)%last line '.....' selected
     657    if ~isempty(hhh)
     658        delete(hhh)%delete the circle marker
     659    end
     660    return
     661end
     662%fill the edit boxex
     663set(handles.XObject,'String',coord_str(1:k(1)-5))
     664set(handles.YObject,'String',coord_str(k(1)+5:k(2)-5))
     665set(handles.ZObject,'String',coord_str(k(2)+5:k(3)-5))
     666set(handles.XImage,'String',coord_str(k(3)+5:k(4)-5))
     667set(handles.YImage,'String',coord_str(k(4)+5:end))
     668h_menu_coord=findobj(huvmat,'Tag','transform_fct');
     669menu=get(h_menu_coord,'String');
     670choice=get(h_menu_coord,'Value');
     671if iscell(menu)
     672    option=menu{choice};
     673else
     674    option='px'; %default
     675end
     676if isequal(option,'phys')
     677    XCoord=str2num(coord_str(1:k(1)-5));
     678    YCoord=str2num(coord_str(k(1)+5:k(2)-5));
     679elseif isequal(option,'px')|| isequal(option,'')
     680    XCoord=str2num(coord_str(k(3)+5:k(4)-5));
     681    YCoord=str2num(coord_str(k(4)+5:end));
     682else
     683    msgbox_uvmat('ERROR','the choice in menu_coord of uvmat must be px or phys ')
     684end
     685if isempty(XCoord)||isempty(YCoord)
     686     if ~isempty(hhh)
     687        delete(hhh)%delete the circle marker
     688    end
     689    return
     690end
     691xlim=get(hplot,'XLim');
     692ylim=get(hplot,'YLim');
     693ind_range=max(abs(xlim(2)-xlim(1)),abs(ylim(end)-ylim(1)))/20;%defines the size of the circle marker
     694if isempty(hhh)
     695    axes(hplot)
     696    rectangle('Curvature',[1 1],...
     697              'Position',[XCoord-ind_range/2 YCoord-ind_range/2 ind_range ind_range],'EdgeColor','m',...
     698              'LineStyle','-','Tag','calib_marker');
     699else
     700    set(hhh,'Position',[XCoord-ind_range/2 YCoord-ind_range/2 ind_range ind_range])
    691701end
    692702
     
    744754Data.CoordType='px';
    745755plot_field(Data)
    746  
    747756
    748757%------------------------------------------------------------------------
     
    750759function key_press_fcn(hObject,eventdata,handles)
    751760%------------------------------------------------------------------------
    752 hh=get(hObject,'parent');
    753 xx=double(get(hh,'CurrentCharacter')); %get the keyboard character
    754 
     761xx=double(get(handles.geometry_calib,'CurrentCharacter')); %get the keyboard character
    755762if ismember(xx,[8 127])%backspace or delete
    756763    Coord_cell=get(handles.ListCoord,'String');
    757     data=read_geometry_calib(Coord_cell);
    758     Coord=[]; %default
    759     if isfield(data,'Coord')
    760         Coord=data.Coord;
    761     end
    762764    val=get(handles.ListCoord,'Value');
    763     Coord(val,:)=[];%suppress the selected item in the list
    764     CoordCell={};
    765     for iline=1:size(Coord,1)
    766         for j=1:5
    767             CoordCell{iline,j}=num2str(Coord(iline,j),4);
    768         end
    769     end
    770     Tabchar=cell2tab(CoordCell,'    |    ');%transform cells into table ready for display
    771     val=min(size(Coord,1),val);
    772     set(handles.ListCoord,'Value',max(val,1))
    773     set(handles.ListCoord,'String',Tabchar) 
    774     ListCoord_Callback(hObject, eventdata, handles)
    775     MenuPlot_Callback(hObject,eventdata,handles)
    776 end
    777 
    778 %------------------------------------------------------------------------
    779 % --- Executes on button press in append_point.
    780 function append_point_Callback(hObject, eventdata, handles)
    781 %------------------------------------------------------------------------
    782        Coord=get(handles.ListCoord,'String');
    783        val=length(Coord);
    784        if val>=1 & isequal(Coord{val},'')
    785             val=val-1; %do not take into account blank
    786        end
    787        Coord{val+1}='';
    788        set(handles.ListCoord,'String',Coord)
    789        set(handles.ListCoord,'Value',val+1)
     765    if val<numel(Coord_cell) % the last element '...' has not been selected
     766        Coord_cell(val)=[];%remove the selected line
     767        set(handles.ListCoord,'String',Coord_cell)         
     768        ListCoord_Callback(hObject, eventdata, handles)
     769        MenuPlot_Callback(hObject,eventdata,handles)
     770    end
     771end
     772
     773% %------------------------------------------------------------------------
     774% % --- Executes on button press in append_point.
     775% function append_point_Callback(hObject, eventdata, handles)
     776% %------------------------------------------------------------------------
     777%        Coord=get(handles.ListCoord,'String');
     778%        val=length(Coord);
     779%        if val>=1 & isequal(Coord{val},'')
     780%             val=val-1; %do not take into account blank
     781%        end
     782%        Coord{val+1}='';
     783%        set(handles.ListCoord,'String',Coord)
     784%        set(handles.ListCoord,'Value',val+1)
    790785
    791786%------------------------------------------------------------------------
     
    836831ObjectData=read_geometry_calib(Coord_cell);
    837832%ObjectData=read_geometry_calib(handles);%read the interface input parameters defining the object
    838 if isequal(option,'phys')
    839     ObjectData.Coord=ObjectData.Coord(:,[1:3]);
    840 elseif isequal(option,'px')||isequal(option,'')
    841     ObjectData.Coord=ObjectData.Coord(:,[4:5]);
    842 else
    843     msgbox_uvmat('ERROR','the choice in menu_coord of uvmat must be px or phys ')
     833if ~isempty(ObjectData.Coord)
     834    if isequal(option,'phys')
     835        ObjectData.Coord=ObjectData.Coord(:,[1:3]);
     836    elseif isequal(option,'px')||isequal(option,'')
     837        ObjectData.Coord=ObjectData.Coord(:,[4:5]);
     838    else
     839        msgbox_uvmat('ERROR','the choice in menu_coord of uvmat must be '''', px or phys ')
     840    end
    844841end
    845842axes(hhuvmat.axes3)
    846843hh=findobj('Tag','calib_points');
    847 if isempty(hh)
     844if  ~isempty(ObjectData.Coord) && isempty(hh)
    848845    hh=line(ObjectData.Coord(:,1),ObjectData.Coord(:,2),'Color','m','Tag','calib_points','LineStyle','.','Marker','+');
     846elseif isempty(ObjectData.Coord)%empty list of points, suppress the plot
     847    delete(hh)
    849848else
    850849    set(hh,'XData',ObjectData.Coord(:,1))
     
    874873    Tinput=CalibData.grid;
    875874end
    876 [T,CalibData.grid]=create_grid(grid_input);%display the GUI create_grid
     875[T,CalibData.grid]=create_grid(Tinput);%display the GUI create_grid
    877876set(handles.geometry_calib,'UserData',CalibData)
    878877
    879878%grid in phys space
    880 Coord_cell=get(handles.ListCoord,'String');
    881 data=read_geometry_calib(Coord_cell);
    882 nbpoints=size(data.Coord,1); %nbre of calibration points
    883 data.Coord(1:size(T,1),1:3)=T;%update the existing list of phys coordinates from the GUI create_grid
    884 for i=1:nbpoints
    885    for j=1:5
     879Coord=get(handles.ListCoord,'String');
     880val=get(handles.ListCoord,'Value');
     881data=read_geometry_calib(Coord);
     882%nbpoints=size(data.Coord,1); %nbre of calibration points
     883data.Coord(val:val+size(T,1)-1,1:3)=T(end:-1:1,:);%update the existing list of phys coordinates from the GUI create_grid
     884% for i=1:nbpoints
     885%    for j=1:5
     886%           Coord{i,j}=num2str(data.Coord(i,j),4);%display coordiantes with 4 digits
     887%    end
     888% end
     889%update the phys coordinates starting from the selected point (down in the
     890Coord(end,:)=[]; %remove last string '.....'
     891for i=1:size(data.Coord,1)
     892    for j=1:5
    886893          Coord{i,j}=num2str(data.Coord(i,j),4);%display coordiantes with 4 digits
    887    end
    888 end
    889 for i=nbpoints+1:size(data.Coord,1)
    890     for j=1:3
    891           Coord{i,j}=num2str(data.Coord(i,j),4);%display coordiantes with 4 digits
    892     end
    893     for j=4:5
    894           Coord{i,j}='';%display coordiantes with 4 digi
    895     end
    896 end
    897 
     894    end
     895end
    898896
    899897%size(data.Coord,1)
    900898Tabchar=cell2tab(Coord,'    |    ');
    901 set(handles.ListCoord,'Value',1)
     899Tabchar=[Tabchar ;{'......'}];
    902900set(handles.ListCoord,'String',Tabchar)
    903901
    904 %-----------------------------------------------------------------------
    905 function MenuTranslatePoints_Callback(hObject, eventdata, handles)
    906 %-----------------------------------------------------------------------
    907 %hcalib=get(handles.calib_type,'parent');%handles of the GUI geometry_calib
    908 CalibData=get(handles.geometry_calib,'UserData');
    909 Tinput=[];%default
    910 if isfield(CalibData,'translate')
    911     Tinput=CalibData.translate;
    912 end
    913 T=translate_points(Tinput);%display translate_points GUI and get shift parameters
    914 CalibData.translate=T;
    915 set(handles.geometry_calib,'UserData',CalibData)
    916 %translation
    917 Coord_cell=get(handles.ListCoord,'String');
    918 data=read_geometry_calib(Coord_cell);
    919 data.Coord(:,1)=T(1)+data.Coord(:,1);
    920 data.Coord(:,2)=T(2)+data.Coord(:,2);
    921 data.Coord(:,3)=T(3)+data.Coord(:,3);
    922 data.Coord(:,[4 5])=data.Coord(:,[4 5]);
    923 for i=1:size(data.Coord,1)
    924     for j=1:5
    925           Coord{i,j}=num2str(data.Coord(i,j),4);%phys x,y,z
    926    end
    927 end
    928 Tabchar=cell2tab(Coord,'    |    ');
    929 set(handles.ListCoord,'Value',1)
    930 set(handles.ListCoord,'String',Tabchar)
    931 
    932 
    933 % --------------------------------------------------------------------
    934 function MenuRotatePoints_Callback(hObject, eventdata, handles)
    935 %hcalib=get(handles.calib_type,'parent');%handles of the GUI geometry_calib
    936 CalibData=get(handles.geometry_calib,'UserData');
    937 Tinput=[];%default
    938 if isfield(CalibData,'rotate')
    939     Tinput=CalibData.rotate;
    940 end
    941 T=rotate_points(Tinput);%display translate_points GUI and get shift parameters
    942 CalibData.rotate=T;
    943 set(handles.geometry_calib,'UserData',CalibData)
    944 %-----------------------------------------------------
    945 %rotation
    946 Phi=T(1);
    947 O_x=0;%default
    948 O_y=0;%default
    949 if numel(T)>=2
    950     O_x=T(2);%default
    951 end
    952 if numel(T)>=3
    953     O_y=T(3);%default
    954 end
    955 Coord_cell=get(handles.ListCoord,'String');
    956 data=read_geometry_calib(Coord_cell);
    957 r1=cos(pi*Phi/180);
    958 r2=-sin(pi*Phi/180);
    959 r3=sin(pi*Phi/180);
    960 r4=cos(pi*Phi/180);
    961 x=data.Coord(:,1)-O_x;
    962 y=data.Coord(:,2)-O_y;
    963 data.Coord(:,1)=r1*x+r2*y;
    964 data.Coord(:,2)=r3*x+r4*y;
    965 % data.Coord(:,[4 5])=data.Coord(:,[4 5]);
    966 for i=1:size(data.Coord,1)
    967     for j=1:5
    968           Coord{i,j}=num2str(data.Coord(i,j),4);%phys x,y,z
    969    end
    970 end
    971 Tabchar=cell2tab(Coord,'    |    ');
    972 set(handles.ListCoord,'Value',1)
    973 set(handles.ListCoord,'String',Tabchar)
    974 % --------------------------------------------------------------------
     902% -----------------------------------------------------------------------
     903% --- automatic grid dectection from local maxima of the images
    975904function MenuDetectGrid_Callback(hObject, eventdata, handles)
    976 
     905%------------------------------------------------------------------------
    977906CalibData=get(handles.geometry_calib,'UserData');
    978907grid_input=[];%default
     
    989918if nbpoints~=4
    990919    msgbox_uvmat('ERROR','four points must be selected by the mouse, beginning by the new x axis, to delimitate the phs grid area')
    991 end
    992 corners_X=(data.Coord(end-3:end,4)); %pixel absissa of the four corners
    993 corners_Y=(data.Coord(end-3:end,5));
    994 
    995 %reorder the last two points if needed
     920    return
     921end
     922corners_X=(data.Coord(end:-1:end-3,4)); %pixel absissa of the four corners
     923corners_Y=(data.Coord(end:-1:end-3,5));
     924
     925%reorder the last two points (the two first in the list) if needed
    996926angles=angle((corners_X-corners_X(1))+i*(corners_Y-corners_Y(1)));
    997927if abs(angles(4)-angles(2))>abs(angles(3)-angles(2))
     
    1015945a_X1=XY_mat\corners_X; %transformation matrix for X
    1016946x1=XY_mat*a_X1;%reconstruction
    1017 err_X1=max(abs(x1-corners_X))%error
     947err_X1=max(abs(x1-corners_X));%error
    1018948a_Y1=XY_mat\corners_Y;%transformation matrix for X
    1019949y1=XY_mat*a_Y1;
    1020 err_Y1=max(abs(y1-corners_Y))%error
     950err_Y1=max(abs(y1-corners_Y));%error
    1021951GeometryCalib.CalibrationType='linear';
    1022952GeometryCalib.CoordUnit=[];% default value, to be updated by the calling function
     
    10721002     Coord{ipoint,5}=num2str(Ypx(ipoint),4);%display coordiantes with 4 digi
    10731003end
    1074 Tabchar=cell2tab(Coord,'    |    ');
     1004Tabchar=cell2tab(Coord(end:-1:1,:),'    |    ');
     1005Tabchar=[Tabchar ;{'......'}];
    10751006set(handles.ListCoord,'Value',1)
    10761007set(handles.ListCoord,'String',Tabchar)
    10771008MenuPlot_Callback(hObject, eventdata, handles)
     1009
     1010%-----------------------------------------------------------------------
     1011function MenuTranslatePoints_Callback(hObject, eventdata, handles)
     1012%-----------------------------------------------------------------------
     1013%hcalib=get(handles.calib_type,'parent');%handles of the GUI geometry_calib
     1014CalibData=get(handles.geometry_calib,'UserData');
     1015Tinput=[];%default
     1016if isfield(CalibData,'translate')
     1017    Tinput=CalibData.translate;
     1018end
     1019T=translate_points(Tinput);%display translate_points GUI and get shift parameters
     1020CalibData.translate=T;
     1021set(handles.geometry_calib,'UserData',CalibData)
     1022%translation
     1023Coord_cell=get(handles.ListCoord,'String');
     1024data=read_geometry_calib(Coord_cell);
     1025data.Coord(:,1)=T(1)+data.Coord(:,1);
     1026data.Coord(:,2)=T(2)+data.Coord(:,2);
     1027data.Coord(:,3)=T(3)+data.Coord(:,3);
     1028data.Coord(:,[4 5])=data.Coord(:,[4 5]);
     1029for i=1:size(data.Coord,1)
     1030    for j=1:5
     1031          Coord{i,j}=num2str(data.Coord(i,j),4);%phys x,y,z
     1032   end
     1033end
     1034Tabchar=cell2tab(Coord,'    |    ');
     1035Tabchar=[Tabchar {'.....'}];
     1036%set(handles.ListCoord,'Value',1)
     1037set(handles.ListCoord,'String',Tabchar)
     1038
     1039
     1040% --------------------------------------------------------------------
     1041function MenuRotatePoints_Callback(hObject, eventdata, handles)
     1042%hcalib=get(handles.calib_type,'parent');%handles of the GUI geometry_calib
     1043CalibData=get(handles.geometry_calib,'UserData');
     1044Tinput=[];%default
     1045if isfield(CalibData,'rotate')
     1046    Tinput=CalibData.rotate;
     1047end
     1048T=rotate_points(Tinput);%display translate_points GUI and get shift parameters
     1049CalibData.rotate=T;
     1050set(handles.geometry_calib,'UserData',CalibData)
     1051%-----------------------------------------------------
     1052%rotation
     1053Phi=T(1);
     1054O_x=0;%default
     1055O_y=0;%default
     1056if numel(T)>=2
     1057    O_x=T(2);%default
     1058end
     1059if numel(T)>=3
     1060    O_y=T(3);%default
     1061end
     1062Coord_cell=get(handles.ListCoord,'String');
     1063data=read_geometry_calib(Coord_cell);
     1064r1=cos(pi*Phi/180);
     1065r2=-sin(pi*Phi/180);
     1066r3=sin(pi*Phi/180);
     1067r4=cos(pi*Phi/180);
     1068x=data.Coord(:,1)-O_x;
     1069y=data.Coord(:,2)-O_y;
     1070data.Coord(:,1)=r1*x+r2*y;
     1071data.Coord(:,2)=r3*x+r4*y;
     1072% data.Coord(:,[4 5])=data.Coord(:,[4 5]);
     1073for i=1:size(data.Coord,1)
     1074    for j=1:5
     1075          Coord{i,j}=num2str(data.Coord(i,j),4);%phys x,y,z
     1076   end
     1077end
     1078Tabchar=cell2tab(Coord,'    |    ');
     1079Tabchar=[Tabchar;{'......'}];
     1080set(handles.ListCoord,'Value',1)
     1081set(handles.ListCoord,'String',Tabchar)
     1082
    10781083
    10791084%%%%%%%%%%%%%%%%%%%%
  • trunk/src/imadoc2struct.m

    r61 r71  
    7474        xindex=findstr(ImageSize,'x');
    7575        if length(xindex)>=2
    76              npx=str2double(ImageSize(1:xindex(1)-1));
    77              npy=str2double(ImageSize(xindex(1)+1:xindex(2)-1));
     76             s.Npx=str2double(ImageSize(1:xindex(1)-1));
     77             s.Npy=str2double(ImageSize(xindex(1)+1:xindex(2)-1));
    7878        end
    7979    end
  • trunk/src/keyboard_callback.m

    r40 r71  
    2424if ismember(xx,[8 127]) %if the delete or suppr key is pressed, delete the current object
    2525    currentobject=gco;
    26     huvmat=findobj(allchild(0),'Name','uvmat');
     26    huvmat=findobj(allchild(0),'tag','uvmat');
    2727%     UvData=get(huvmat,'UserData');%Data associated to the current uvmat interface
    28     hlist_object=findobj(huvmat,'Tag','list_object');
     28    hlist_object=findobj(huvmat,'Tag','list_object_1');
    2929    ObjIndex=get(hlist_object,'Value')
    30     if ObjIndex>1
     30    if ObjIndex>1 
    3131        delete_object(ObjIndex)
    3232    end
  • trunk/src/mouse_down.m

    r67 r71  
    2525
    2626MouseAction='none'; %default
    27 huvmat=findobj(allchild(0),'Name','uvmat');%find the uvmat interface handle which controls theoption of  mouse action
     27huvmat=findobj(allchild(0),'tag','uvmat');%find the uvmat interface handle which controls theoption of  mouse action
    2828if isempty(huvmat)
    2929    return
     
    4949%edit an existing point or line if found
    5050hcurrentobject=gco;% current object handle (selected by the mouse)
    51 hcurrentfig=gcbo;% current figure handle
     51hcurrentfig=hObject;% current figure handle
    5252fig_tag=get(hcurrentfig,'Tag');
    5353tag_obj=get(gco,'Tag');
     
    105105end   
    106106
     107% zoom has first priority
    107108if testzoom %&& ~test_create && ~test_edit && ~test_edit_vect && exist('xy','var')
    108109     AxeData.Drawing='zoom'; %initiate drawing mode
    109110     AxeData.CurrentObject=[];%unselect objects
     111     set(haxes,'UserData',AxeData);
    110112     return
    111113end
    112114if isempty(huvmat)
     115    return
     116end
     117
     118%ruler has second priority
     119if test_ruler
     120    UvData.RulerCoord(1,1)=xy(1,1);
     121    UvData.RulerCoord(1,2)=xy(1,2);
     122    UvData.RulerHandle=line([xy(1,1) xy(1,1)],[xy(1,2) xy(1,2)],'Color','m','Tag','ruler');
     123    set(huvmat,'UserData',UvData)
     124    AxeData.Drawing='ruler';
     125    set(haxes,'UserData',AxeData);
    113126    return
    114127end
     
    163176            end
    164177            IndexObj=ObjectData.IndexObj;
    165             set(hhuvmat.list_object_1,'Value',IndexObj);
    166             set(hhuvmat.list_object_2,'Value',IndexObj);
     178                    %indicate on the list of the GUI uvmat which object has been selected
     179            if strcmp(get(hcurrentfig,'tag'),'uvmat') %if the uvmat graph has been selected, object projection is on the other frame view_field
     180                set(hhuvmat.list_object_2,'Value',IndexObj);
     181            else
     182                set(hhuvmat.list_object_1,'Value',IndexObj);
     183            end
    167184            testdeform=0;
    168185            set(gcbo,'Pointer','circle');
     
    207224        set(huvmat,'UserData',UvData)
    208225        list_str=get(hhuvmat.list_object_1,'String');
    209         list_str{IndexObj}=[num2str(IndexObj) '-' ObjectData.Style];
    210         if ~isequal(list_str{end},'...')
    211              list_str{end+1}='...';
    212         end
     226        list_str{IndexObj}=[num2str(IndexObj) '-' ObjectData.Style];
    213227        set(hhuvmat.list_object_1,'String',list_str)
     228        list_str{end+1}='...';
    214229        set(hhuvmat.list_object_2,'String',list_str)
    215230        if strcmp(fig_tag,'view_field')%we are in view_field plot
    216               set(hhuvmat.list_object_1,'Value',IndexObj)
     231              set(hhuvmat.list_object_1,'Value',IndexObj)% the projection field will be plotted in uvmat frame
    217232        else%we are in uvmat plot
    218233            set(hhuvmat.list_object_2,'Value',IndexObj)
     
    234249        if ~(isequal(coord_value,1)||isequal(coord_value,3)); %active only with no transform or px (no phys)
    235250            set(hhuvmat.transform_fct,'Value',1)
     251            uvmat('transform_fct_Callback',hObject,eventdata,hhuvmat); %file input with xml reading  in uvmat
    236252            set(hhuvmat.FixedLimits,'Value',0)% put FixedLimits option to 'off'
    237253            set(hhuvmat.FixedLimits,'BackgroundColor',[0.7 0.7 0.7])
    238             uvmat('run0_Callback',hObject,eventdata,hhuvmat); %file input with xml reading  in uvmat
    239254            return
    240255        end
    241256        Coord=get(h_ListCoord,'String');
    242         data=read_geometry_calib(Coord)%transform char cell to numbers
     257        data=read_geometry_calib(Coord);%transform char cell to numbers
    243258        ind_range=10;%range of research around each existing point
    244259        test_newpoint=1;
     
    255270             val=get(h_ListCoord,'Value');
    256271             if length(Coord)>=val
    257                  Coord(val+1:length(Coord)+1)=Coord(val:length(Coord))% push the list forward beyond the current point
     272                 Coord(val+1:length(Coord)+1)=Coord(val:length(Coord));% push the list forward beyond the current point
    258273             end
    259274             Coord{val}=strline;
    260275             set(h_ListCoord,'String',Coord)
    261             set(h_ListCoord,'Value',val+1)
     276            % set(h_ListCoord,'Value',val+1)
    262277             data=read_geometry_calib(Coord);%transform char cell to numbers
    263278             XCoord=data.Coord(:,4);
     
    274289        hhh=findobj('Tag','calib_marker');%look for handle of point marker (circle)
    275290        if ~isempty(hhh)
    276             set(hhh,'XData',xy(1,1))
    277             set(hhh,'YData',xy(1,2))
     291            set(hhh,'Position',[xy(1,1)-ind_range/2 xy(1,2)-ind_range/2 ind_range ind_range])
    278292        else
    279             line([xy(1,1) xy(1,1)],[xy(1,2) xy(1,2)],'Color','m','Tag','calib_marker','LineStyle','.','Marker','o','MarkerSize',20);
    280         end
     293            rectangle('Curvature',[1 1],...
     294                  'Position',[xy(1,1)-ind_range/2 xy(1,2)-ind_range/2 ind_range ind_range],'EdgeColor','m',...
     295                  'LineStyle','-','Tag','calib_marker');
     296           % line([xy(1,1) xy(1,1)],[xy(1,2) xy(1,2)],'Color','m','Tag','calib_marker','LineStyle','.','Marker','o','MarkerSize',ind_range);
     297        end
     298        AxeData.Drawing='calibration';
    281299    end
    282300end
     
    296314end   
    297315
    298 %create ruler
    299 if test_ruler
    300     UvData.RulerCoord(1,1)=xy(1,1);
    301     UvData.RulerCoord(1,2)=xy(1,2);
    302     UvData.RulerHandle=line([xy(1,1) xy(1,1)],[xy(1,2) xy(1,2)],'Color','m','Tag','ruler');
    303     set(huvmat,'UserData',UvData)
    304 end
     316
    305317set(haxes,'UserData',AxeData);
    306318
  • trunk/src/mouse_motion.m

    r67 r71  
    2727    return
    2828end
     29test_draw=0;
    2930test_create=0;%default
    30 test_edit=0;%default
    31 test_edit=isfield(handles,'edit') & get(handles.edit,'Value');% edit test for mouse shap: an arrow
    32 test_zoom=isfield(handles,'zoom')& get(handles.zoom,'Value');% edit test for mouse shap: an arrow
     31test_object=0; %default
     32test_edit=isfield(handles,'edit') && get(handles.edit,'Value');% edit test for mouse shap: an arrow
     33test_zoom_draw=0; %default
     34test_ruler=0;
     35huvmat=findobj(allchild(0),'Name','uvmat');%find the uvmat interface handle
     36if ~isempty(huvmat)
     37    UvData=get(huvmat,'UserData');
     38    test_ruler=isfield(UvData,'MouseAction') && isequal(UvData.MouseAction,'ruler');
     39end
     40
    3341
    3442%find the current axe 'haxes' and display the current mouse position or uicontrol tag
     
    3846text_displ_4='';
    3947
    40 haxes=[];
    4148AxeData=[];%default
    4249mouse=[];
     
    4451
    4552pointershape='arrow';% default pointer is an arrow
    46 currentfig=gcbo;%store gcbo as variable currentfig
     53currentfig=hObject;
    4754xy_fig=get(currentfig,'CurrentPoint');% current point of the current figure (gcbo)
    4855hchild=get(currentfig,'Children');%handles of all objects in the current figure
    4956
    50 % loop on all the objects in the current figure (selected by the last mouse click)
     57% loop on all the objects in the current figure and detect whether the mouse is over a plot  axes
     58haxes=[];
    5159for ichild=1:length(hchild)
    5260    obj_pos=get(hchild(ichild),'Position');%position of the object
     
    6876            ivec=[];
    6977            AxeData=get(haxes,'UserData');% data attached to the axis
    70              if ~test_edit && ~test_zoom
     78            if isfield(AxeData,'Drawing')&& ~isempty(AxeData.Drawing)
     79                test_draw=~isequal(AxeData.Drawing,'off');
     80            end
     81            test_zoom_draw=test_draw && isequal(AxeData.Drawing,'zoom')&& isfield(AxeData,'CurrentOrigin') && isequal(get(gcf,'SelectionType'),'normal');
     82            test_object=test_draw && isfield(AxeData,'CurrentObject') && ~isempty(AxeData.CurrentObject) && ishandle(AxeData.CurrentObject);       
     83             if ~test_edit && ~test_zoom_draw && ~test_ruler
    7184                 pointershape='crosshair';%set pointer with cross shape (default when mouse is over an axis)
    72 %                % pointershape='crosshair';%set pointer with cross shape (default over axis)
    7385             end
    7486            if isfield(AxeData,'X') && isfield(AxeData,'Y') && isfield(AxeData,'Mesh')% test on the existence of a vector field in the current axis
     
    7890                    ivec=find(flag_vec,1);% search the (first) selected vector index ivec
    7991                    hhh=findobj(haxes,'Tag','vector_marker');
    80                     if ~isempty(ivec)
    81                         %ivec=ivec(1);%choice the first selected vector if several are selected
    82                         if ~test_create
    83                             pointershape='arrow'; %mouse indicates  the detection of a vector
    84                             if isempty(hhh)
    85                                 set(currentfig,'CurrentAxes',haxes)
    86                                 rectangle('Curvature',[1 1],...
    87                   'Position',[AxeData.X(ivec)-AxeData.Mesh AxeData.Y(ivec)/2-AxeData.Mesh/2 AxeData.Mesh AxeData.Mesh],'EdgeColor','m',...
    88                   'LineStyle','-','Tag','vector_marker');
    89 %                                 line(AxeData.X(ivec),AxeData.Y(ivec),'Color','m','Tag','vector_marker','LineStyle','.','Marker','o','MarkerSize',AxeData.Mesh);
    90                             else
    91                                 set(hhh,'Position',[AxeData.X(ivec)-AxeData.Mesh/2 AxeData.Y(ivec)-AxeData.Mesh/2 AxeData.Mesh AxeData.Mesh])
     92                    if ~isempty(ivec)
     93                        if ~test_object % mark the vectors with a circle in the absence of other operations
     94                            if  ~test_create && ~test_edit && ~test_ruler
     95                                pointershape='arrow'; %mouse indicates  the detection of a vector
     96                                if isempty(hhh)
     97                                     hstack=findobj(allchild(0),'Type','figure');%current stack order of figures in matlab
     98                                    axes(haxes)
     99                                    rectangle('Curvature',[1 1],...
     100                      'Position',[AxeData.X(ivec)-AxeData.Mesh/2 AxeData.Y(ivec)-AxeData.Mesh/2 AxeData.Mesh AxeData.Mesh],'EdgeColor','m',...
     101                      'LineStyle','-','Tag','vector_marker');
     102                                    set(0,'Children',hstack);%put back the initial figure stack after plot creation
     103                                else
     104                                    set(hhh,'Position',[AxeData.X(ivec)-AxeData.Mesh/2 AxeData.Y(ivec)-AxeData.Mesh/2 AxeData.Mesh AxeData.Mesh])
     105                                end
    92106                            end
    93                         end                 
     107                        end
    94108                        mouse.X=AxeData.X(ivec);
    95109                        mouse.Y=AxeData.Y(ivec);
     
    193207set(handles.text_display_3,'String',text_displ_3);
    194208set(handles.text_display_4,'String',text_displ_4);
     209if ~test_draw
     210    return
     211end
     212% At this stage  if no drawing  operation is done
     213
     214
     215%%%%%%%%%%%%%
     216%draw a zoom rectangle if no object creation is selected
     217if test_zoom_draw
     218   xy_rect=AxeData.CurrentOrigin;
     219   if ~isempty(xy_rect)
     220        rect(1)=min(xy(1,1),xy_rect(1));%origin rectangle, x coordinate
     221        rect(2)=min(xy(1,2),xy_rect(2));%origin rectangle, y coordinate
     222        rect(3)=abs(xy(1,1)-xy_rect(1));%rectangle width
     223        rect(4)=abs(xy(1,2)-xy_rect(2));%rectangle height
     224        if rect(3)>0 & rect(4)>0
     225            if isfield(AxeData,'CurrentRectZoom')& ishandle(AxeData.CurrentRectZoom)
     226                set(AxeData.CurrentRectZoom,'Position',rect);%update the rectangle position
     227            else
     228                AxeData.CurrentRectZoom=rectangle('Position',rect,'LineStyle',':','Tag','rect_zoom');
     229                set(haxes,'UserData',AxeData)
     230            end
     231        end
     232   end
     233    pointershape='arrow';
     234end
    195235
    196236%%%%%%%%%%%%%%%%%
    197237%create or modify an object
    198 huvmat=findobj(allchild(0),'Name','uvmat');%find the uvmat interface handle
    199 if ~isempty(huvmat)
    200     UvData=get(huvmat,'UserData');
    201 end
    202 if ~isempty(huvmat) & isfield(AxeData,'CurrentObject') & ishandle(AxeData.CurrentObject) & isfield(AxeData,'Drawing') & ~isequal(AxeData.Drawing,'off')
     238
     239if ~isempty(huvmat) && test_object
    203240    PlotData=get(AxeData.CurrentObject,'UserData');
    204241    huvmat=findobj(allchild(0),'Name','uvmat');%find the uvmat interface handle
     
    250287end   
    251288
    252 %%%%%%%%%%%%%
    253 %draw a zoom rectangle if no object creation is selected
    254 if ~isempty(haxes) & isfield(AxeData,'Drawing')& isequal(AxeData.Drawing,'zoom')& isfield(AxeData,'CurrentOrigin')...
    255         & isequal(get(gcf,'SelectionType'),'normal')%
    256    xy_rect=AxeData.CurrentOrigin;
    257    if ~isempty(xy_rect)
    258         rect(1)=min(xy(1,1),xy_rect(1));%origin rectangle, x coordinate
    259         rect(2)=min(xy(1,2),xy_rect(2));%origin rectangle, y coordinate
    260         rect(3)=abs(xy(1,1)-xy_rect(1));%rectangle width
    261         rect(4)=abs(xy(1,2)-xy_rect(2));%rectangle height
    262         if rect(3)>0 & rect(4)>0
    263             if isfield(AxeData,'CurrentRectZoom')& ishandle(AxeData.CurrentRectZoom)
    264                 set(AxeData.CurrentRectZoom,'Position',rect);%update the rectangle position
    265             else
    266                 AxeData.CurrentRectZoom=rectangle('Position',rect,'LineStyle',':','Tag','rect_zoom');
    267                 set(haxes,'UserData',AxeData)
    268             end
    269         end
    270    end
    271 % end
    272 % if test_zoom
    273     pointershape='arrow';
    274 end
    275 
    276289% detect calibration points if the GUI geometry_calib is opened
    277290h_geometry_calib=findobj(allchild(0),'Name','geometry_calib'); %find the geomterty_calib GUI
    278 if ~test_zoom && ~isempty(h_geometry_calib)
     291if ~test_zoom_draw && ~isempty(h_geometry_calib)
    279292    pointershape='crosshair';%default for geometry_calib: ready to create new points
    280293    hh_geometry_calib=guidata(h_geometry_calib);
     
    303316                    hhh=findobj('Tag','calib_marker');%look for handle of point marker (circle)
    304317                    if ~isempty(hhh)
    305                         set(hhh,'XData',XCoord(index_point))
    306                         set(hhh,'YData',YCoord(index_point))
     318                        set(hhh,'Position',[XCoord(index_point)-ind_range/2 YCoord(index_point)-ind_range/2 ind_range ind_range])
     319%                         set(hhh,'XData',XCoord(index_point))
     320%                         set(hhh,'YData',YCoord(index_point))
    307321                    end
    308322                end         
     
    313327
    314328%draw ruler
    315 if ~isempty(huvmat)
    316     UvData=get(huvmat,'UserData');
    317     if isfield(UvData,'MouseAction') && isequal(UvData.MouseAction,'ruler')
     329if test_ruler && isequal(AxeData.Drawing,'ruler')
    318330           if isfield(UvData,'RulerHandle')
    319331               pointershape='crosshair';
     
    322334                set(UvData.RulerHandle,'YData',RulerCoord(:,2));
    323335           end
    324     end
    325336end
    326337set(currentfig,'Pointer',pointershape);
  • trunk/src/mouse_up.m

    r67 r71  
    11%'mouse_up': function  activated when the mouse button is released
    22%----------------------------------------------------------------
    3 % function mouse_up(ggg,eventdata,handles)
     3% function mouse_up(hObject,eventdata,handles)
    44% activated by the command:
    55% set(hObject,'WindowButtonUpFcn',{'mouse_up'}),
     
    2222%AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
    2323
    24 function mouse_up(ggg,eventdata,handles)
     24function mouse_up(hObject,eventdata,handles)
    2525MouseAction='none'; %default
    2626zoomstate=0;%default
     
    3737    zoomstate=get(hhuvmat.zoom,'Value');
    3838end
    39 % if isequal(MouseAction,'calib') && ~zoomstate
    40 %     return
    41 % end
    42 currentfig=gcbo;
    43 AxeData=get(gca,'UserData');
     39currentfig=hObject;
    4440currentaxes=gca; %store the current axes handle
     41AxeData=get(currentaxes,'UserData');
     42
    4543test_drawing=0;%default
    4644
     
    5250    IndexObj=PlotData.IndexObj;
    5351    ObjectData=UvData.Object{IndexObj};   
     52    ObjectData.enable_plot=1;
    5453    if isequal(AxeData.Drawing,'translate')
    5554        XYData=AxeData.CurrentOrigin;
     
    264263% editing calibration point
    265264if strcmp(MouseAction,'calib')
    266     xy=get(currentaxes,'CurrentPoint');%xy(1,1),xy(1,2): current x,y positions in axes coordinates
    267     hh=findobj('Tag','calib_points')%look for handle of calibration points           
     265    hh=findobj(currentaxes,'Tag','calib_points')%look for handle of calibration points           
    268266    if ~isempty(hh)
    269267        set(hh,'UserData',[])%remove edit mode
    270     end   
    271     strline=[ '    |    '  '    |    '  '    |    ' num2str(xy(1,1),4) '    |    ' num2str(xy(1,2),4)];
    272     h_geometry_calib=findobj(allchild(0),'Name','geometry_calib'); %find the geomterty_calib GUI
    273     hh_geometry_calib=guidata(h_geometry_calib);
    274     h_ListCoord=hh_geometry_calib.ListCoord; %findobj(h_geometry_calib,'Tag','ListCoord');
    275     Coord=get(h_ListCoord,'String');
    276     val=get(h_ListCoord,'Value');
    277 %     if length(Coord)>=val
    278 %         Coord(val+1:length(Coord)+1)=Coord(val:length(Coord));% push the list forward beyond the current point
    279 %     end
    280     Coord{val}=strline;
    281     set(h_ListCoord,'String',Coord)
    282     %set(h_ListCoord,'Value',val+1)
    283     %geometry_calib('ListCoord_Callback',hObject,eventdata,hh_geometry_calib)
    284     %data=read_geometry_calib(Coord);%transform char cell to numbers
    285     %XCoord=data.Coord(:,4);
    286     %YCoord=data.Coord(:,5)
     268        h_geometry_calib=findobj(allchild(0),'Name','geometry_calib'); %find the geomterty_calib GUI
     269        hh_geometry_calib=guidata(h_geometry_calib);
     270        h_ListCoord=hh_geometry_calib.ListCoord; %handles of the coordinate list
     271        Coord=get(h_ListCoord,'String');
     272        val=get(h_ListCoord,'Value');
     273        coord_str=Coord{val}; %current line (string)
     274        k=findstr('|',coord_str);%find separator indices on the string
     275        xy=get(currentaxes,'CurrentPoint');%xy(1,1),xy(1,2): current x,y positions in axes coordinates
     276        if numel(k)>=3
     277            coord_str=[coord_str(1:k(3)-1) '|    ' num2str(xy(1,1),4) '    |    ' num2str(xy(1,2),4)]; %update the pixel information while preserving phys coord
     278        else
     279            coord_str=[ '    |    '  '    |    '  '    |    ' num2str(xy(1,1),4) '    |    ' num2str(xy(1,2),4)];
     280        end
     281        Coord{val}=coord_str;       
     282        set(h_ListCoord,'String',Coord)
     283    end
    287284end
    288285
     
    301298    hruler=findobj(currentaxes,'Tag','ruler');
    302299    delete(hruler)
     300    AxeData.Drawing='off';%stop current drawing a
    303301end
    304302
  • trunk/src/plot_field.m

    r61 r71  
    100100
    101101function [PlotType,PlotParamOut,haxes]= plot_field(Data,haxes,PlotParam,KeepLim,PosColorbar)
     102
    102103%default output
    103104if ~exist('PlotParam','var'),PlotParam=[];end;
     
    151152    haxes=axes;
    152153    set(haxes,'position',[0.13,0.2,0.775,0.73])
     154else
     155    hstack=findobj(allchild(0),'Type','figure');%current stack order of figures in matlab
    153156end
    154157if isfield(PlotParam,'text_display_1')& ishandle(PlotParam.text_display_1)
     
    226229
    227230set(haxes,'UserData',AxeData)
     231if ~testnewfig
     232set(0,'Children',hstack);%put back the initial figure stack after plot creation
    228233%set(haxes,'Tag','uvmat');
    229 
    230  
    231 % %-------------------------------------------
    232 % function [AxeData,haxes]=plot_hist(Data,haxes,PlotParam)% TODO: chech whether this function is still used, replace by plot_profile ?
    233 % %------------------------------------------
    234 % AxeData=get(haxes,'UserData'); %defau
    235 % hfig=get(haxes,'parent');
    236 % if ~isfield(Data,'ListVarName')
    237 %     return
    238 % end
    239 % ColorOrder=[1 0 0;0 0.5 0;0 0 1;0 0.75 0.75;0.75 0 0.75;0.75 0.75 0;0.25 0.25 0.25];
    240 % set(haxes,'ColorOrder',ColorOrder)
    241 % if isfield(PlotParam,'NextPlot')
    242 %     set(haxes,'NextPlot',PlotParam.NextPlot)
    243 % end
    244 % charplot='''-''';
    245 % iplot=0;
    246 % legend_str={};
    247 % label_str='';
    248 % textmean={};
    249 % plotstr='plot(';
    250 % for ilist=1:length(Data.ListVarName)
    251 %     VarName=Data.ListVarName{ilist};
    252 %     eval(['[' VarName 'hist,' VarName 'val]=hist(double(Data.' VarName '),100);']);%coordinate variable set as c
    253 %     plotstr=[plotstr VarName 'val,' VarName 'hist,' charplot ','];
    254 %     eval(['nbcomponent2=size(Data.' VarName ',2);']);
    255 %     eval(['nbcomponent1=size(Data.' VarName ',1);']);
    256 %     eval(['varmean=mean(double(Data.' VarName '));']);%mean value
    257 %     textmean=[textmean; {[VarName 'mean= ' num2str(varmean,4)]}];
    258 %     if nbcomponent1==1| nbcomponent2==1
    259 %         legend_str=[legend_str {VarName}]; %variable with one component
    260 %     else
    261 %         for ic=1:min(nbcomponent1,nbcomponent2)
    262 %             legend_str=[legend_str [VarName '_' num2str(ic)]]; %variable with severals  components
    263 %                                                                % labeled by their index (e.g. color component)
    264 %         end
    265 %     end
    266 %     label_str=[label_str ' ' VarName];
    267 % end
    268 % if ~isequal(plotstr,'plot(')
    269 %     plotstr(end)=')';
    270 %     eval(plotstr)
    271 %     hlegend=findobj(hfig,'Tag','legend');%find existing legend on the plot
    272 %     if ~isempty(hlegend)
    273 %         legend_old=get(hlegend,'String');
    274 %         if isequal(size(legend_old,1),size(legend_str,1))
    275 %              legend_str=[legend_old legend_str];
    276 %         end
    277 %     end
    278 %     legend(legend_str)
    279 %     xlabel(label_str)
    280 %     ylabel('nb values')
    281 %      grid on
    282 %     title_str='';
    283 %     if isfield(Data,'filename')
    284 %        [Path, title_str, ext]=fileparts(Data.filename);
    285 %        title_str=[title_str ext];
    286 %     end
    287 %     if isfield(Data,'Action')
    288 %         if ~isequal(title_str,'')
    289 %             title_str=[title_str ', '];
    290 %         end
    291 %         title_str=[title_str Data.Action];
    292 %     end
    293 %     htitle=title(title_str);
    294 %     set(htitle,'Interpreter','none')% desable tex interpreter
    295 %     hlist=findobj(gcf,'Style','listbox');
    296 %     if isempty(hlist)
    297 %             uicontrol('Style','popupmenu','Position',[20 20 200 20],'String',textmean);
    298 %     else
    299 %             set(hlist(1),'String',textmean)
    300 %     end
    301 % end
    302 % AxeData=Data;
     234end
    303235
    304236
     
    309241hfig=get(haxes,'parent');
    310242AxeData=data;
     243
    311244ColorOrder=[1 0 0;0 0.5 0;0 0 1;0 0.75 0.75;0.75 0 0.75;0.75 0.75 0;0.25 0.25 0.25];
    312245set(haxes,'ColorOrder',ColorOrder)
     
    325258
    326259%initiates string of the plot command
    327 plotstr='plot(';
     260plotstr='hhh=plot(';
    328261textmean={};
    329262abscissa_name='';
    330263coord_x_index=[];
     264test_newplot=1;
    331265for icell=1:length(CellVarIndex)
    332266    testfalse=0;
     
    354288    charplot_0='''-''';%default
    355289    if isfield(data,'ObjectProjMode')& isequal(data.ObjectProjMode,'projection')
    356         charplot_0='''+''';
     290        charplot_0='+';
    357291    end
    358292    xtitle=''; 
     
    372306            testplot(VarType{icell}.warnflag)=0;
    373307    end
    374     if ~isempty(VarType{icell}.discrete')
    375          charplot_0='''+''';
    376     else
    377           charplot_0='''-''';
    378     end
     308 
    379309    if isfield(data,'VarAttribute')
    380310        VarAttribute=data.VarAttribute;
     
    387317        end
    388318    end
    389     for ivar=1:length(VarIndex)
    390         if testplot(VarIndex(ivar))
    391             VarName=data.ListVarName{VarIndex(ivar)};
    392             eval(['data.' VarName '=squeeze(data.' VarName ');'])
    393             if isequal(VarName,'A')
    394                 charplot='''-''';
    395             else
    396                 charplot=charplot_0;
    397             end
    398             plotstr=[plotstr 'coord_x{' num2str(icell) '},data.' VarName ',' charplot ','];
    399             eval(['nbcomponent2=size(data.' VarName ',2);']);
    400             eval(['nbcomponent1=size(data.' VarName ',1);']);
    401             if numel(coord_x{icell})==2
    402                 coord_x{icell}=linspace(coord_x{icell}(1),coord_x{icell}(2),nbcomponent1);
    403             end
    404             eval(['varmean=mean(double(data.' VarName '));']);%mean value
    405             textmean=[textmean; {[VarName 'mean= ' num2str(varmean,4)]}];
    406             if nbcomponent1==1| nbcomponent2==1
    407                 legend_str=[legend_str {VarName}]; %variable with one component
    408             else  %variable with severals  components
    409                 for ic=1:min(nbcomponent1,nbcomponent2)
    410                     legend_str=[legend_str [VarName '_' num2str(ic)]]; %variable with severals  components
    411                 end                                                   % labeled by their index (e.g. color component)
    412             end
    413         end
    414     end
    415 end
    416 if ~isequal(plotstr,'plot(')
    417     plotstr(end)=')';
    418                 %execute plot (instruction  plotstr)   
     319    hh=findobj(haxes,'tag','plot_line');
     320    if isequal(numel(hh),numel(find(testplot(VarIndex))))%update existing curves
     321        icurve=0;
     322        test_newplot=0;
     323        if ~isempty(VarType{icell}.discrete')
     324            charplot_0='+';
     325            LineStyle='none';
     326        else
     327            charplot_0='none';
     328            LineStyle='-';
     329        end
     330        for ivar=1:length(VarIndex)
     331            if testplot(VarIndex(ivar))
     332                icurve=icurve+1;
     333                VarName=data.ListVarName{VarIndex(ivar)};
     334                eval(['data.' VarName '=squeeze(data.' VarName ');'])
     335                set(hh(icurve),'LineStyle',LineStyle)
     336                set(hh(icurve),'Marker',charplot_0)
     337%                 if isequal(VarName,'A')
     338%                     set(hh(icurve),'LineStyle','-');
     339%                 else
     340%                     set(hh(icurve),'LineStyle',charplot_0);
     341%                 end
     342                set(hh(icurve),'XData',coord_x{icell})
     343                eval(['yy=data.' VarName ';'])
     344                set(hh(icurve),'YData',yy);
     345%                 eval(['nbcomponent2=size(data.' VarName ',2);']);
     346%                 eval(['nbcomponent1=size(data.' VarName ',1);']);
     347%                 if numel(coord_x{icell})==2
     348%                     coord_x{icell}=linspace(coord_x{icell}(1),coord_x{icell}(2),nbcomponent1);
     349%                 end
     350%                 eval(['varmean=mean(double(data.' VarName '));']);%mean value
     351%                 textmean=[textmean; {[VarName 'mean= ' num2str(varmean,4)]}];
     352%                 if nbcomponent1==1| nbcomponent2==1
     353%                     legend_str=[legend_str {VarName}]; %variable with one component
     354%                 else  %variable with severals  components
     355%                     for ic=1:min(nbcomponent1,nbcomponent2)
     356%                         legend_str=[legend_str [VarName '_' num2str(ic)]]; %variable with severals  components
     357%                     end                                                   % labeled by their index (e.g. color component)
     358%                 end
     359            end
     360        end
     361    else% new plot
     362        if ~isempty(VarType{icell}.discrete')
     363            charplot_0='''+''';
     364        else
     365            charplot_0='''-''';
     366        end
     367        for ivar=1:length(VarIndex)
     368            if testplot(VarIndex(ivar))
     369                VarName=data.ListVarName{VarIndex(ivar)};
     370                eval(['data.' VarName '=squeeze(data.' VarName ');'])
     371%                 if isequal(VarName,'A')
     372%                     charplot='''-''';
     373%                 else
     374%                     charplot=charplot_0;
     375%                 end
     376                plotstr=[plotstr 'coord_x{' num2str(icell) '},data.' VarName ',' charplot_0 ','];
     377                eval(['nbcomponent2=size(data.' VarName ',2);']);
     378                eval(['nbcomponent1=size(data.' VarName ',1);']);
     379                if numel(coord_x{icell})==2
     380                    coord_x{icell}=linspace(coord_x{icell}(1),coord_x{icell}(2),nbcomponent1);
     381                end
     382                eval(['varmean=mean(double(data.' VarName '));']);%mean value
     383                textmean=[textmean; {[VarName 'mean= ' num2str(varmean,4)]}];
     384                if nbcomponent1==1| nbcomponent2==1
     385                    legend_str=[legend_str {VarName}]; %variable with one component
     386                else  %variable with severals  components
     387                    for ic=1:min(nbcomponent1,nbcomponent2)
     388                        legend_str=[legend_str [VarName '_' num2str(ic)]]; %variable with severals  components
     389                    end                                                   % labeled by their index (e.g. color component)
     390                end
     391            end
     392        end
     393    end
     394end
     395if test_newplot && ~isequal(plotstr,'plot(')
     396    plotstr=[plotstr '''tag'',''plot_line'')']
     397                %execute plot (instruction  plotstr) 
    419398    eval(plotstr)
     399   
    420400                %%%%%
    421     grid on
     401    grid(haxes, 'on')
    422402    hxlabel=xlabel(xtitle);
    423403    set(hxlabel,'Interpreter','none')% desable tex interpreter
     
    478458%----------------------------------------
    479459function [AxeData,haxes,PlotParamOut,PlotType]=plot_plane(Data,CellVarIndex,VarTypeCell,haxes,PlotParam,KeepLim,PosColorbar)
    480 
     460grid(haxes, 'off')
    481461%default plotting parameters
    482462PlotType='plane';%default
  • trunk/src/proj_field.m

    r55 r71  
    769769            ProjData.VarDimName=[ProjData.VarDimName {XName}];
    770770            ProjData.VarAttribute{iselect}=FieldData.VarAttribute{VarIndex(iselect)};
     771            if strcmp(ProjMode,'projection')
     772                ProjData.VarAttribute{iselect}.Role='discrete';
     773            else
     774                 ProjData.VarAttribute{iselect}.Role='continuous';
     775            end
    771776        end
    772777   
     
    876881                ProjData.ListVarName=[ProjData.ListVarName VarName{ivar} ];
    877882                ProjData.VarDimName=[ProjData.VarDimName {AXName}];%to generalize with the initial name of the x coordinate
     883                ProjData.VarAttribute{ivar}.Role='continuous';% for plot with continuous line
    878884            end
    879885            if testU
  • trunk/src/read_geometry_calib.m

    r36 r71  
    22%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    33function data=read_geometry_calib(Coord_cell)
    4 data_XIma=[];
    5 data_YIma=[];
    6 data_XObject=[];
    7 data_YObject=[];
    8 data_ZObject=[];
    9 %Coord=get(handles.ListCoord,'String');
    10 % XImage=get(handles.XImage,'String');
    11 % YImage=get(handles.YImage,'String');
    12 % XObject=get(handles.XObject,'String');
    13 % YObject=get(handles.YObject,'String');
    14 % ZObject=get(handles.ZObject,'String');
    15 % if ischar(Xcolumn)
    16 %     Xcolumn={Xcolumn};
    17 % end
    184nb_defining_points=length(Coord_cell);
    195iline=0;
     
    2814        data4=str2num(coord_str(k(3)+5:k(4)-5));
    2915        data5=str2num(coord_str(k(4)+5:end));
    30         if ~isempty(data1)|~isempty(data2)|~isempty(data3)|~isempty(data4)|~isempty(data5)
     16        if ~isempty(data1)||~isempty(data2)||~isempty(data3)||~isempty(data4)||~isempty(data5)
    3117            iline=iline+1;
    3218            if ~isempty(data1)
  • trunk/src/series/ima_levels.m

    r64 r71  
    6969Mfiltre=Mfiltre/(sum(sum(Mfiltre)));
    7070
    71 C=filter2(ones(windowsize)/windowsize^2,B);
     71C=filter2(Mfiltre,B);
    7272C(:,1:windowsize)=C(:,windowsize)*ones(1,windowsize);
    7373C(:,end-windowsize+1:end)=C(:,end-windowsize+1)*ones(1,windowsize);
  • trunk/src/series/relabel_i_j.m

    r41 r71  
    101101Mfiltre=Mfiltre/(sum(sum(Mfiltre)));
    102102
    103 C=filter2(ones(windowsize)/windowsize^2,B);
     103C=filter2(Mfiltre,B);
    104104C(:,1:windowsize)=C(:,windowsize)*ones(1,windowsize);
    105105C(:,end-windowsize+1:end)=C(:,end-windowsize+1)*ones(1,windowsize);
  • trunk/src/set_object.m

    r67 r71  
    8989     PlotHandles=[];
    9090end
    91 enable_plot=0;%default
    92 SetData.PlotHandles=PlotHandles;
    93 % if exist('data','var') && isfield(data,'ParentButton')
    94 %         SetData.ParentButton=data.ParentButton;
    95 %         set(hObject,'DeleteFcn',{@closefcn,SetData.ParentButton})%
    96 % end
    97 set(hObject,'UserData',SetData)
     91enable_plot=0;%default: does not allow plot of object and projection
     92% SetData.PlotHandles=PlotHandles;
     93% set(hObject,'UserData',SetData)
    9894
    9995% fill the interface as set in the input data:
    10096if exist('data','var')
    101     if isfield(data,'desable_plot')
    102         enable_plot=~data.desable_plot;%test to desable button PLOT (display mode)
     97    if isfield(data,'enable_plot')
     98        enable_plot=data.enable_plot;%test to desable button PLOT (display mode)
     99    end
     100    if isfield(data,'Name')
     101        set(handles.TITLE,'String',data.Name)
    103102    end
    104103    if ~isfield(data,'NbDim')||~isequal(data.NbDim,3)%2D case
     
    732731function PLOT_Callback(hObject, eventdata, handles)
    733732
    734 SetData=get(handles.set_object,'UserData');%get the hidden interface data
    735 huvmat=findobj('Name','uvmat');%find the current uvmat interface handle
    736 hlist_object=findobj(huvmat,'Tag','list_object_1');%handles of the object list in the GUI uvmat
    737 IndexObj=get(hlist_object,'Value');%position in the objet list
     733%SetData=get(handles.set_object,'UserData');%get the hidden interface data
     734huvmat=findobj('tag','uvmat');%find the current uvmat interface handle
    738735UvData=get(huvmat,'UserData');%Data associated to the GUI uvmat
     736hhuvmat=guidata(huvmat);%handles in the uvmat GUI
     737ObjectName=get(handles.set_object,'name');%name ome)f the current object (set_object na
     738ListObject=get(hhuvmat.list_object_1,'String');%position in the objet list
     739IndexObj_1=get(hhuvmat.list_object_1,'Value');
     740IndexObj_2=get(hhuvmat.list_object_2,'Value');
     741
     742% set(plotfig,'Name',['Projection on' num2str(IndexObj) '-' ObjectData.Style]);
    739743ObjectData=read_set_object(handles);%read the input parameters defining the object in the GUI set_object
    740 ObjectData.HandlesDisplay=[]; % new object plot by default
    741 if length(UvData.Object) >= IndexObj && isfield(UvData.Object{IndexObj},'HandlesDisplay')
    742     hdisplay=UvData.Object{IndexObj}.HandlesDisplay;
    743     if isequal(UvData.Object{IndexObj}.Style, ObjectData.Style) && isequal(UvData.Object{IndexObj}.ProjMode, ObjectData.ProjMode)
    744         ObjectData.HandlesDisplay=UvData.Object{IndexObj}.HandlesDisplay;
    745     else  % for a new object styl, delete the existing object plots
    746         for ih=1:length(hdisplay)
    747             PlotData=get(hdisplay(ih),'UserData');
    748             if isfield(PlotData,'SubObject') & ishandle(PlotData.SubObject)
    749                     delete(PlotData.SubObject);
    750             end
    751             if isfield(PlotData,'DeformPoint') & ishandle(PlotData.DeformPoint)
    752                    delete(PlotData.DeformPoint);
    753             end
    754             if ~isequal(hdisplay(ih),0)
    755                 delete(hdisplay(ih));
    756             end
    757         end
    758         if isfield(ObjectData,'plotaxes') && ishandle(ObjectData.plotaxes)
    759             delete(ObjectData.plotaxes)%delete the axes for plotting the current projection result
    760         end
    761     end     
    762 end
     744PlotHandles=[];%default
     745testnew=0;
     746if strcmp(ListObject{IndexObj_1},ObjectName)% we are editing the object whose projection is viewed in the uvmat frame
     747   ObjectData.HandlesDisplay=handles.axes3;
     748    PlotHandles=get_plot_handles(handles);
     749    IndexObj=IndexObj_1;
     750elseif strcmp(ListObject{IndexObj_2},ObjectName)% we are editing the object whose projection is viewed in view_field
     751    hview_field=findobj('tag','view_field');
     752    if ~isempty(hview_field)
     753        PlotHandles=guidata(hview_field);
     754%         PlotHandles=get_plot_handles( hhview_field);
     755        ObjectData.HandlesDisplay=PlotHandles.axes3;%handle of axes3 in view_field
     756    end
     757    IndexObj=IndexObj_2;
     758else %new object
     759    testnew=1;
     760   
     761    IndexObj=numel(ListObject)+1;
     762    %ObjectName=[num2str(IndexObj) '-' ObjectData.Style];
     763%     ListObject=[ListObject;ObjectName];
     764%     set(hhuvmat.list_object_2,'String',[ListObject;ObjectName;{'...'}])
     765%     set(hhuvmat.list_object_2,'Value',IndexObj)
     766end
     767ObjectName=get(handles.TITLE,'String');
     768if length(ObjectName)<1
     769    ObjectName=[num2str(IndexObj) '-' ObjectData.Style];
     770else
     771    for ilist=1:numel(ListObject)
     772        if strcmp(ListObject{ilist},ObjectName)
     773            ObjectName=[num2str(IndexObj) '-' ObjectName];
     774            break
     775        end
     776    end
     777end
     778ListObject{IndexObj,1}=ObjectName;
     779set(hhuvmat.list_object_1,'String',ListObject)
     780set(hhuvmat.list_object_2,'String',[ListObject;{'...'}])
     781set(handles.set_object,'name',ObjectName);%update the name of set_object so that it equals its corresponding object in the list
     782if testnew
     783    set(hhuvmat.list_object_2,'Value',IndexObj)
     784end
     785% ObjectData.HandlesDisplay=[]; % new object plot by default
     786% if length(UvData.Object) >= IndexObj && isfield(UvData.Object{IndexObj},'HandlesDisplay')
     787%     hdisplay=UvData.Object{IndexObj}.HandlesDisplay;
     788%     if isequal(UvData.Object{IndexObj}.Style, ObjectData.Style) && isequal(UvData.Object{IndexObj}.ProjMode, ObjectData.ProjMode)
     789%         ObjectData.HandlesDisplay=UvData.Object{IndexObj}.HandlesDisplay;
     790%     else  % for a new object styl, delete the existing object plots
     791%         for ih=1:length(hdisplay)
     792%             PlotData=get(hdisplay(ih),'UserData');
     793%             if isfield(PlotData,'SubObject') & ishandle(PlotData.SubObject)
     794%                     delete(PlotData.SubObject);
     795%             end
     796%             if isfield(PlotData,'DeformPoint') & ishandle(PlotData.DeformPoint)
     797%                    delete(PlotData.DeformPoint);
     798%             end
     799%             if ~isequal(hdisplay(ih),0)
     800%                 delete(hdisplay(ih));
     801%             end
     802%         end
     803%         if isfield(ObjectData,'plotaxes') && ishandle(ObjectData.plotaxes)
     804%             delete(ObjectData.plotaxes)%delete the axes for plotting the current projection result
     805%         end
     806%     end     
     807% end
    763808
    764809% update the object plot and projection field
    765 UvData.Object{IndexObj}=update_obj(UvData,IndexObj,ObjectData,SetData.PlotHandles);
    766 
     810UvData.Object{IndexObj}=update_obj(UvData,IndexObj,ObjectData,PlotHandles);
    767811
    768812set(huvmat,'UserData',UvData)%update the data in the uvmat interface
    769 list_str=get(hlist_object,'String');
    770 % TITLE=set_title(ObjectData.Style,ObjectData.ProjMode);
    771 % list_str{IndexObj}=[num2str(IndexObj) '-' TITLE];
    772 list_str{IndexObj}=[num2str(IndexObj) '-' ObjectData.Style];
    773 % if isequal(length(list_str),IndexObj)
    774 %     list_str{IndexObj+1}='more...';
    775 % end
    776 set(hlist_object_1,'String',list_str)
    777 set(hlist_object_1,'Value',IndexObj)
    778 
    779 %update create buttons on the GUI uvmat: set to object edit mode after object plotting
     813% list_str=get(hlist_object,'String');
     814% list_str{IndexObj}=[num2str(IndexObj) '-' ObjectData.Style];
     815% set(hlist_object_1,'String',list_str)
     816% set(hlist_object_1,'Value',IndexObj)
     817
     818%set uvmat to object edit mode to allow further object update
    780819hhuvmat=guidata(huvmat);%handles of elements in the uvmat GUI
    781 %desactivate all create buttons in mode edit
    782 % if isequal(get(hhuvmat.edit,'Value'),0)
    783 %     set(hhuvmat.create,'Value',0)
    784 %     set(hhuvmat.create,'BackgroundColor',[0 1 0])%put unactivated buttons to green
    785 %     set(hhuvmat.LINE,'Value',0)
    786 %     set(hhuvmat.LINE,'BackgroundColor',[0 1 0])%put unactivated buttons to green
    787 %     set(hhuvmat.PATCH,'Value',0)
    788 %     set(hhuvmat.PATCH,'BackgroundColor',[0 1 0])%put unactivated buttons to green
    789 %     set(hhuvmat.PLANE,'Value',0)
    790 %     set(hhuvmat.PLANE,'BackgroundColor',[0 1 0])%put unactivated buttons to green
    791 %     set(hhuvmat.VOLUME,'Value',0)
    792 %     set(hhuvmat.VOLUME,'BackgroundColor',[0 1 0])%put unactivated buttons to green
    793 % end
    794820set(hhuvmat.MenuEditObject,'enable','on')
    795821set(hhuvmat.edit,'Value',1)
     
    848874title={'object name'};
    849875dir_save=uigetdir(RootPath);
    850 def={fullfile(dir_save,['Object' Object.CoordType '.xml'])};
     876ObjectName=get(handles.TITLE,'String');
     877if ~isempty(ObjectName)&&~strcmp(ObjectName,'')
     878    def={fullfile(dir_save,[ObjectName Object.CoordType '.xml'])};
     879else
     880    def={fullfile(dir_save,[Object.Style Object.CoordType '.xml'])};
     881end
    851882options.Resize='on';
    852883displ_txt='save object as an .xml file';%default display
  • trunk/src/transform_field/im_levels.m

    r40 r71  
    1818Mfiltre=Mfiltre/(sum(sum(Mfiltre)));
    1919
    20 C=filter2(ones(windowsize)/windowsize^2,B);
     20C=filter2(Mfiltre,B);
    2121C(:,1:windowsize)=C(:,windowsize)*ones(1,windowsize);
    2222C(:,end-windowsize+1:end)=C(:,end-windowsize+1)*ones(1,windowsize);
  • trunk/src/update_obj.m

    r67 r71  
    99%
    1010%INPUT:
    11 %UvIn: structure stored as 'Userdata' on the uvmat interface
     11%UvData: structure stored as 'Userdata' on the uvmat interface, it contains
     12%    .Object{1},{2}... description of all the projection objects
     13%    .Object{iview}.plotaxes: axes for the plot of the field projected on this object
     14%    .Object{iview}.HandlesDisplay(ih): array of handles for plots representing the object #iview in the field #ih
    1215%IndexObjIn: object index for an existing objects stored in UvData
    1316%ObjectData: structure containing the input object properties
    14 %PlotHandles: structure containing the handles of the plotting parameter buttons on the uvmat interface (obtained by get_plot_handles.m)
     17%       .Style: style of the object: 'line', 'rectangle'...
     18%PlotHandles: structure containing the handles of the plotting parameter buttons on the uvmat or view_field interface
    1519%-------------------------------------
    1620
     
    3539                 HandlesDisplay=Object_set{IndexObj}.HandlesDisplay;%list of handles of object representations
    3640             end
    37              hplot_list=findobj(haxes,'Tag','proj_object');
     41             hplot_list=findobj(haxes,'Tag','proj_object');%list of projection objects on the axes
    3842             for ih=1:length(HandlesDisplay)
    3943                 plot_detect=find(hplot_list==HandlesDisplay(ih));
     
    4650             if ~testupdate% draw new object plot
    4751                hh=plot_object(ObjectData,Object_set{iview},haxes,'m');%draw the object with the new object data
    48                 Object_out.HandlesDisplay=[Object_out.HandlesDisplay hh];
     52                if isfield(Object_out,'HandlesDisplay')
     53                    Object_out.HandlesDisplay=[Object_out.HandlesDisplay hh];
     54                else
     55                    Object_out.HandlesDisplay=hh;
     56                end
    4957                PlotData=get(hh,'UserData');
    5058                PlotData.IndexObj=IndexObj;
     
    5563end
    5664% plot the field projected on the object
    57 if ~isempty(PlotHandles) %&& ~testmask
     65% if ~isempty(PlotHandles) %&& ~testmask
    5866    ProjData= proj_field(UvData.Field,ObjectData,IndexObj);%project the current interface field on ObjectData
    5967    if ~isempty(ProjData)   
    6068        plotaxes=[];%default
     69%         get(Object_set{IndexObj}.plotaxes)
    6170        if length(Object_set)>= IndexObj && isfield(Object_set{IndexObj},'plotaxes')
    6271            plotaxes=Object_set{IndexObj}.plotaxes;
     
    7382        end
    7483    end
    75 end
     84% end
    7685
    7786
  • trunk/src/uvmat.m

    r67 r71  
    195195function uvmat_OpeningFcn(hObject, eventdata, handles, input )
    196196%-------------------------------------------------------------------
    197 %WARNING: avoid the second input parameter, leads to erros
    198 global dircur dir_opening nb_builtin
     197global nb_builtin
     198
    199199% Choose default command menuline output for uvmat
    200200handles.output = hObject;
     
    202202% Update handles structure
    203203guidata(hObject, handles);
    204 
    205 dircur=pwd; %current working directory
    206 dir_opening=dircur;
    207204
    208205% set the position of colorbar and ancillary GUIs:
     
    247244if ~isfield(UvData.Object{1},'plotaxes')
    248245    UvData.Object{1}.plotaxes=handles.axes3;%default plotting axis
     246    set(handles.list_object_1,'Value',1);
    249247    set(handles.list_object_1,'String',{'1-PLANE'});
    250     set(handles.list_object_1,'Value',1);
    251248end
    252249
     
    382379        set(handles.list_object_1,'Visible','on')
    383380        set(handles.frame_object,'Visible','on')
     381        if ~isempty(errormsg)
     382            msgbox_uvmat('ERROR',errormsg)
     383        end
    384384    else
    385385        update_rootinfo(hObject,eventdata,handles);
     
    566566        set(handles.FileExt,'String',ext);
    567567        % fill file index counters
    568         set(handles.i1,'String',i1);
    569      
     568        set(handles.i1,'String',i1);   
    570569        set(handles.i2,'String',i2);
    571570        set(handles.j1,'String',str_a);
     
    574573        % synchronise indices of the second  input file if it exists
    575574        if get(handles.SubField,'Value')==1% if the subfield button is activated, update the field numbers
    576             [FileName_1,RootPath_1,FileBase_1,FileIndices_1,FileExt_1,SubDir_1]=read_file_boxes_1(handles);
     575            [ff,rr,FileBase_1,ii,FileExt_1,SubDir_1]=read_file_boxes_1(handles);
    577576            NomType_1=get(handles.FileIndex_1,'UserData');     
    578             [FileName_1,idetect]=name_generator(FileBase_1,stra2num(i1),stra2num(i2),FileExt_1,NomType_1,1,stra2num(str_a),stra2num(str_b),SubDir_1);
    579             if idetect
     577            FileName_1=name_generator(FileBase_1,stra2num(i1),stra2num(i2),FileExt_1,NomType_1,1,stra2num(str_a),stra2num(str_b),SubDir_1);
     578            if exist(FileName_1,'file')
    580579                FileIndex_1=name_generator('',stra2num(i1),stra2num(i2),'',NomType_1,1,stra2num(str_a),stra2num(str_b),'');
    581580                set(handles.FileIndex_1,'String',FileIndex_1)
     
    636635%-------------------------------------------------------------------
    637636function update_rootinfo(hObject,eventdata,handles)
    638 global dircur  dir_opening
    639637
    640638set(handles.RootPath,'BackgroundColor',[1 1 0])
     
    11521150end
    11531151TimeUnit_1=[];
    1154 testima=0; %test for image input
     1152% testima=0; %test for image input
    11551153if isequal(lower(FileExt),'.avi') %.avi file
    1156     testima=1;
     1154%     testima=1;
    11571155    info=aviinfo([FileBase FileIndices FileExt]);
    11581156    nbfield_1=info.NumFrames;
     
    13681366function nb_slice_Callback(hObject, eventdata, handles)
    13691367%-------------------------------------------------------------------
    1370 nb_slice_str=get(handles.nb_slice,'String')
     1368nb_slice_str=get(handles.nb_slice,'String');
    13711369if isequal(nb_slice_str,'volume')
    13721370    num=stra2num(get(handles.j1,'String'));
     
    16641662     num1=num1+increment;
    16651663     num2=num2+increment;
    1666      [filename,num1,num_a,num2,num_b]=name_generator(filebase,num1,num_a,FileExt,NomType,comp_input,num2,num_b,subdir)
     1664     [filename,num1,num_a,num2,num_b]=name_generator(filebase,num1,num_a,FileExt,NomType,comp_input,num2,num_b,subdir);
    16671665     if sub_value% set the second field name and indices
    16681666        num1_1=num1_1+increment;
     
    19821980sub_value=get(handles.SubField,'Value');
    19831981FileType_1='none';%default
    1984 %if sub_value==
    1985 filename_1
    19861982if ~isempty(filename_1)
    19871983    % test for a constant second field (comparison with a fixed field)
    19881984    NomType_1=get(handles.FileIndex_1,'UserData');
    1989     Ext_1=get(handles.FileExt_1,'String')
     1985    Ext_1=get(handles.FileExt_1,'String');
    19901986    % determine the input file type
    19911987    if isequal(Ext_1,'.nc')||isequal(Ext_1,'.cdf')
     
    24742470if ~isfield(UvData.Object{1},'plotaxes')
    24752471    UvData.Object{1}.plotaxes=handles.axes3;%default plotting axis
    2476     set(handles.list_object_1,'String',{'1-PLANE'});
    24772472    set(handles.list_object_1,'Value',1);
     2473    set(handles.list_object_1,'String',{'1-PLANE'}); 
    24782474end
    24792475
     
    25262522    IndexObj(2)=IndexObj_2;
    25272523end
    2528 for iobj=IndexObj
     2524for imap=1:numel(IndexObj)
     2525    iobj=IndexObj(imap);
    25292526    if ~isempty(UvData.Object{iobj})%& isfield(Object{iobj},'plotaxes')& ishandle(Object{iobj}.plotaxes)
    25302527        %Projeter les champs sur l'objet:*
    25312528        ObjectData=proj_field(UvData.Field,UvData.Object{iobj},iobj);
    2532    
     2529        if imap==2
     2530            UvData.ProjField_2=ObjectData;%store the projection field on uvmat: ***** WILL REPLACE THE FIELD SORED ON THE AXES: AxeData *****
     2531        else
     2532            UvData.ProjField_1=ObjectData;%store the projection field on view_field
     2533        end
    25332534        %use of mask
    25342535        if isfield(ObjectData,'NbDim')&isequal(ObjectData.NbDim,2)
     
    37743775if isequal(coord_option,'more...');
    37753776    coord_fct='';
    3776 
    3777 %     if exist(profil_perso,'file')
    3778 %           h=load (profil_perso);
    3779 %          if isfield(h,'transform_fct')
    3780 %                 transform_fct=h.transform_fct;
    3781 %          end
    3782 %     end
    37833777    prompt = {'Enter the name of the transform function'};
    37843778    dlg_title = 'user defined transform';
     
    37943788    transform_selected =fullfile(PathName,FileName);
    37953789    if ~exist(transform_selected,'file')
    3796 %            msgbox_uvmat('ERROR',['procesing fct ' transform_selected ' not found'])
    37973790           return
    37983791    end
     
    38273820    set(handles.path_transform,'String','')
    38283821end
    3829 %CurrentPath=fileparts(which(coord_option));
    3830 % if ~isequal(PathName,CurrentPath)
    3831 %     addpath(PathName)
    3832 %     errormsg=check_functions;
    3833 %     msgbox_uvmat('WARNING',[['path ' PathName ' added to the current Matlab pathes'];errormsg])
    3834 % end
    3835 %set(handles.path_transform,'String',fullfile(PathName,' ')); %show the path to the senlected function
     3822
    38363823set(handles.FixedLimits,'Value',0)
    38373824set(handles.FixedLimits,'BackgroundColor',[0.7 0.7 0.7])
     
    38573844end
    38583845if isfield(UvData,'Object')
    3859     nbobject=length(UvData.Object);
    3860     UvData.Object([2:nbobject])=[];
     3846     UvData.Object=UvData.Object(1);
    38613847end
     3848list_object=get(handles.list_object_1,'String');
     3849set(handles.list_object_1,'Value',1)
     3850set(handles.list_object_1,'String',list_object(1))
     3851set(handles.list_object_2,'Value',2)
     3852set(handles.list_object_2,'String',[list_object(1);{'...'}])
     3853list_object_2_Callback(hObject, eventdata, handles)
     3854
     3855
    38623856
    38633857%delete mask if it is displayed
     
    41814175    hhset_object=guidata(hset_object);
    41824176    if test
    4183         set(hhset_object.PLOT,'Visible','on');
     4177        set(hhset_object.PLOT,'enable','on');
    41844178    else
    4185        set(hhset_object.PLOT,'Visible','off');
     4179       set(hhset_object.PLOT,'enable','off');
    41864180    end
    41874181end
     
    41964190val_2=get(handles.list_object_2,'Value');
    41974191str_2=get(handles.list_object_2,'String');
    4198 if isequal(val_2,IndexObj)
    4199     set(handles.list_object_2,'Value',numel(str_2))
     4192if isequal(val_2,IndexObj)% if the first selection is equal to the second, it will suppress the second
     4193    set(handles.list_object_2,'Value',numel(str_2))%select the end of the list ('...')
    42004194    list_object_2_Callback(hObject, eventdata, handles)
    42014195end
    4202 hset_object=findobj(allchild(0),'Tag','set_object');
    4203 if ~isempty(hset_object)
    4204      set(hset_object,'name',str_1);
    4205 end
    4206 update_object(handles,IndexObj,1)
     4196update_object(handles,IndexObj,1,str_1)
    42074197
    42084198%------------------------------------------------------------------------
     
    42134203IndexObj=get(handles.list_object_2,'Value');
    42144204if isequal(list_str{IndexObj},'...')
    4215     hview_field=findobj(allchild(0),'Tag','view_field')
     4205    hview_field=findobj(allchild(0),'Tag','view_field');
    42164206    if ~isempty(hview_field)
    42174207        delete(hview_field)
    42184208    end
    4219     set(handles.list_object_2,'BackgroundColor',[1 1 1])
    4220 else
    4221     hset_object=findobj(allchild(0),'Tag','set_object');
    4222     if ~isempty(hset_object)
    4223         set(hset_object,'name',list_str{IndexObj});
    4224     end
    4225 %     set(handles.list_object_2,'BackgroundColor',[1 1 0])
    4226 %     set(handles.list_object_1,'BackgroundColor',[1 1 1])
    4227     update_object(handles,IndexObj,2)
     4209else
     4210    update_object(handles,IndexObj,2,list_str{IndexObj})
    42284211end
    42294212
    42304213%------------------------------------------------------------------------
    4231 function update_object(handles,IndexObj,option)
     4214function update_object(handles,IndexObj,option,ObjectName)
    42324215%------------------------------------------------------------------------
    42334216UvData=get(handles.uvmat,'UserData');%read UvData properties stored on the uvmat interface
     
    42364219end
    42374220ObjectData=UvData.Object{IndexObj};
    4238 if isequal(get(handles.edit,'Value'),0)
    4239     ObjectData.desable_plot=1; % desable the PLOT option in the set_object GUI (editing mode
     4221ObjectData.Name=ObjectName;
     4222if isequal(get(handles.edit,'Value'),1)
     4223    ObjectData.enable_plot=1; % desable the PLOT option in the set_object GUI (editing mode
    42404224end
    42414225PlotHandles=get_plot_handles(handles);%get the handles of the interface elements setting the plotting parameters
     
    42454229        ZBounds(2)=UvData.ZMax;%maximum for the Z slider
    42464230    end
    4247 hset_object=findobj(allchild(0),'Name','set_object');
     4231hset_object=findobj(allchild(0),'tag','set_object');
    42484232if ~isempty(hset_object)
    42494233    delete(hset_object)% delete existing version of set_object
    42504234end
    42514235hset_object=set_object(ObjectData,PlotHandles,ZBounds);% call the set_object interface,
     4236set(hset_object,'name',ObjectName)
    42524237pos_uvmat=get(handles.uvmat,'Position');
    42534238%position the set_object GUI with respect to uvmat
     
    43274312%------------------------------------------------------
    43284313function MenuExportField_Callback(hObject, eventdata, handles)
    4329 
    43304314global CurData
    4331 huvmat=get(handles.RootPath,'parent');
    4332 CurData=get(huvmat,'UserData');
     4315huvmat=findobj(allchild(0),'Name','uvmat');
     4316UvData=get(huvmat,'UserData');
     4317CurData=UvData.ProjField_1;
    43334318evalin('base','global CurData')%make CurData global in the workspace
    4334 display(['UserData of uvmat :'])
     4319display(['UserData of view_field :'])
    43354320evalin('base','CurData') %display CurData in the workspace
    43364321commandwindow;
     
    44504435% ------------------------------------------------------------------
    44514436function MenuCalib_Callback(hObject, eventdata, handles)
    4452 % set(handles.TOOLS_txt,'Visible','on')
    4453 % set(handles.frame_tools,'Visible','on')
     4437
    44544438UvData=get(handles.uvmat,'UserData');%read UvData properties stored on the uvmat interface
    4455 %reinitialize the edit interface associated with uvmat
    4456 %suppress the other options if MENULINE is chosen
     4439
     4440%suppress competing options
    44574441set(handles.zoom,'Value',0)
    44584442set(handles.zoom,'BackgroundColor',[0.7 0.7 0.7])
    4459 set(handles.MenuTools,'enable','off')
     4443set(handles.MenuMask,'enable','off')
     4444set(handles.MenuGrid,'enable','off')
    44604445set(handles.MenuObject,'enable','off')
    44614446set(handles.MenuEdit,'enable','off')
    4462 %         set(handles.create,'Value',0)
    4463 %         set(handles.create,'BackgroundColor',[0 1 0])
    4464 %         set(handles.create,'enable','off')     
    4465 % set(handles.edit_vect,'Value',0)
    4466 % set(handles.edit_vect,'enable','off')
    4467 % edit_vect_Callback(hObject, eventdata, handles)
    4468 % set(handles.edit,'Value',0)
    4469 % set(handles.edit,'BackgroundColor',[0.7 0.7 0.7])
    4470 % set(handles.edit,'enable','off')
    44714447set(handles.list_object_1,'Value',1)     
    44724448% initiate display of GUI geometry_calib
     
    44814457[UvData.hset_object,UvData.sethandles]=geometry_calib(handles,pos,FileName);% call the set_object interface     
    44824458pos_uvmat=get(handles.uvmat,'Position');
    4483 %pos_cal(1:2)=UvData.CalOrigin + pos_uvmat(1:2);
     4459
    44844460if isfield(UvData,'CalOrigin')
    44854461    pos_cal(1)=pos_uvmat(1)+UvData.CalOrigin(1)*pos_uvmat(3);
     
    46464622    end
    46474623end     
    4648 varargin{1}=filebase;
    4649 varargin{2}=NomType;
    4650 varargin{3}=num1;
    4651 varargin{4}=num2;
    4652 varargin{5}=num_a;
    4653 varargin{6}=num_b;
    4654 varargin{7}=SubDir;
    4655 varargin{8}=ind_opening;% A REVOIR +TRANSMETTRE IMADOC INFO
    4656 varargin{11}=ext;
    4657 civ(varargin);% interface de civ(not in the uvmat file)
     4624param.RootName=filebase;
     4625param.NomType=NomType;
     4626param.num1=num1;
     4627param.num2=num2;
     4628param.num_a=num_a;
     4629param.num_b=num_b;
     4630param.SubDir=SubDir;
     4631param.IndOpening=ind_opening;% A REVOIR +TRANSMETTRE IMADOC INFO
     4632param.ImaExt=ext;
     4633civ(param);% interface de civ(not in the uvmat file)
    46584634
    46594635% ------------------------------------------------------------------
     
    47634739t=xmltree(fileinput);
    47644740data=convert(t);
    4765 PlotHandles=get_plot_handles(handles);%get the handles of the interface elements setting the plotting parameters
     4741data.enable_plot=1;
     4742[pp,data.Name]=fileparts(FileName);
     4743%PlotHandles=get_plot_handles(handles);%get the handles of the interface elements setting the plotting parameters
    47664744hset_object=findobj(allchild(0),'Name','set_object');
    47674745if ~isempty(hset_object)
    47684746    delete(hset_object)% delete existing version of set_object
    47694747end
    4770 [hset_object,UvData.sethandles]=set_object(data,PlotHandles);% call the set_object interface
     4748UvData=get(handles.uvmat,'UserData');
     4749[hset_object,UvData.sethandles]=set_object(data);% call the set_object interface
    47714750%position the set_object GUI with respect to uvmat
    47724751pos_uvmat=get(handles.uvmat,'Position');
     
    47824761
    47834762%------------------------------------------------------------------------
     4763% --- generic function used for the creation of a projection object
    47844764function create_object(data,handles)
    47854765%------------------------------------------------------------------------
     
    47914771set(handles.edit,'Value',0); %suppress the object edit mode
    47924772set(handles.edit,'BackgroundColor',[0.7,0.7,0.7]) 
     4773data.enable_plot=1;
    47934774if isfield(UvData,'CoordType')
    47944775    data.CoordType=UvData.CoordType;
     
    48354816zoom_Callback(handles.uvmat, [], handles)
    48364817
    4837 
    4838 
    4839 % --------------------------------------------------------------------
     4818%------------------------------------------------------------------------
    48404819function MenuRuler_Callback(hObject, eventdata, handles)
     4820%------------------------------------------------------------------------
    48414821set(handles.zoom,'Value',0)
    48424822zoom_Callback(handles.uvmat, [], handles)
     
    48464826
    48474827%------------------------------------------------------------------------
    4848 % executed when closing: set the parent interface button to value 0
     4828% --- executed when closing: set the parent interface button to value 0
    48494829function closefcn(gcbo,eventdata)
    48504830%------------------------------------------------------------------------
     
    48634843    set(hhh,'enable','off')
    48644844end
     4845
     4846
     4847% --- Executes on button press in delete_object.
     4848function delete_object_Callback(hObject, eventdata, handles)
     4849IndexObj=get(handles.list_object_2,'Value');
     4850    if IndexObj>1
     4851        delete_object(IndexObj)
     4852    end
     4853   
     4854
  • trunk/src/view_field.m

    r67 r71  
    23442344global CurData
    23452345huvmat=findobj(allchild(0),'Name','uvmat');
    2346 CurData=get(huvmat,'UserData');
     2346UvData=get(huvmat,'UserData');
     2347CurData=UvData.ProjField_2;
    23472348evalin('base','global CurData')%make CurData global in the workspace
    23482349display(['UserData of view_field :'])
     
    24712472
    24722473
    2473 % --- Executes during object creation, after setting all properties.
    2474 function colcode1_CreateFcn(hObject, eventdata, handles)
    2475 % hObject    handle to colcode1 (see GCBO)
     2474
     2475% --- Executes on button press in checkbox42.
     2476function checkbox42_Callback(hObject, eventdata, handles)
     2477% hObject    handle to checkbox42 (see GCBO)
    24762478% eventdata  reserved - to be defined in a future version of MATLAB
    2477 % handles    empty - handles not created until after all CreateFcns called
    2478 
    2479 % Hint: edit controls usually have a white background on Windows.
    2480 %       See ISPC and COMPUTER.
    2481 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    2482     set(hObject,'BackgroundColor','white');
    2483 end
    2484 
    2485 
    2486 % --- Executes during object creation, after setting all properties.
    2487 function slider2_CreateFcn(hObject, eventdata, handles)
    2488 % hObject    handle to slider2 (see GCBO)
     2479% handles    structure with handles and user data (see GUIDATA)
     2480
     2481% Hint: get(hObject,'Value') returns toggle state of checkbox42
     2482
     2483
     2484% --- Executes on button press in checkbox43.
     2485function checkbox43_Callback(hObject, eventdata, handles)
     2486% hObject    handle to checkbox43 (see GCBO)
    24892487% eventdata  reserved - to be defined in a future version of MATLAB
    2490 % handles    empty - handles not created until after all CreateFcns called
    2491 
    2492 % Hint: slider controls usually have a light gray background.
    2493 if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    2494     set(hObject,'BackgroundColor',[.9 .9 .9]);
    2495 end
    2496 
    2497 
    2498 % --- Executes during object creation, after setting all properties.
    2499 function slider1_CreateFcn(hObject, eventdata, handles)
    2500 % hObject    handle to slider1 (see GCBO)
     2488% handles    structure with handles and user data (see GUIDATA)
     2489
     2490% Hint: get(hObject,'Value') returns toggle state of checkbox43
     2491
     2492
     2493% --- Executes on button press in checkbox44.
     2494function checkbox44_Callback(hObject, eventdata, handles)
     2495% hObject    handle to checkbox44 (see GCBO)
    25012496% eventdata  reserved - to be defined in a future version of MATLAB
    2502 % handles    empty - handles not created until after all CreateFcns called
    2503 
    2504 % Hint: slider controls usually have a light gray background.
    2505 if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    2506     set(hObject,'BackgroundColor',[.9 .9 .9]);
    2507 end
    2508 
    2509 
    2510 % --- Executes during object creation, after setting all properties.
    2511 function colcode2_CreateFcn(hObject, eventdata, handles)
    2512 % hObject    handle to colcode2 (see GCBO)
     2497% handles    structure with handles and user data (see GUIDATA)
     2498
     2499% Hint: get(hObject,'Value') returns toggle state of checkbox44
     2500
     2501
     2502% --- Executes on selection change in popupmenu18.
     2503function popupmenu18_Callback(hObject, eventdata, handles)
     2504
     2505
     2506function edit91_Callback(hObject, eventdata, handles)
     2507% hObject    handle to edit91 (see GCBO)
    25132508% eventdata  reserved - to be defined in a future version of MATLAB
    2514 % handles    empty - handles not created until after all CreateFcns called
    2515 
    2516 % Hint: edit controls usually have a white background on Windows.
    2517 %       See ISPC and COMPUTER.
    2518 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    2519     set(hObject,'BackgroundColor','white');
    2520 end
    2521 
    2522 
     2509% handles    structure with handles and user data (see GUIDATA)
     2510
     2511% Hints: get(hObject,'String') returns contents of edit91 as text
     2512%        str2double(get(hObject,'String')) returns contents of edit91 as a double
     2513
     2514
     2515% --- Executes on button press in checkbox45.
     2516function checkbox45_Callback(hObject, eventdata, handles)
     2517% hObject    handle to checkbox45 (see GCBO)
     2518% eventdata  reserved - to be defined in a future version of MATLAB
     2519% handles    structure with handles and user data (see GUIDATA)
     2520
     2521% Hint: get(hObject,'Value') returns toggle state of checkbox45
     2522
     2523
     2524% --- Executes on selection change in popupmenu19.
     2525function popupmenu19_Callback(hObject, eventdata, handles)
     2526% hObject    handle to popupmenu19 (see GCBO)
     2527% eventdata  reserved - to be defined in a future version of MATLAB
     2528% handles    structure with handles and user data (see GUIDATA)
     2529
     2530% Hints: contents = get(hObject,'String') returns popupmenu19 contents as cell array
     2531%        contents{get(hObject,'Value')} returns selected item from popupmenu19
     2532
     2533
     2534
     2535
Note: See TracChangeset for help on using the changeset viewer.