Changeset 71 for trunk/src/civ.m


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

File:
1 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
Note: See TracChangeset for help on using the changeset viewer.