Changeset 12


Ignore:
Timestamp:
Feb 16, 2010, 3:19:38 PM (11 years ago)
Author:
gostiaux
Message:

The files from uvmat.2.2.beta that differed from the current version have been updated.
Now the /raid/soft/UVMAT/src should be operational

Location:
trunk/src
Files:
13 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/civ.m

    r2 r12  
    2222function varargout = civ(varargin)
    2323
    24 % Last Modified by GUIDE v2.5 29-Oct-2009 19:05:39
     24% Last Modified by GUIDE v2.5 10-Jan-2010 22:04:45
    2525% Begin initialization code - DO NOT EDIT
    2626gui_Singleton = 1;
     
    4242% End initialization code - DO NOT EDIT
    4343
    44 %--------------------------------------------------------------------------
     44%------------------------------------------------------------------------
    4545% --- Executes just before civ is made visible.
    46 %--------------------------------------------------------------------------
    4746function civ_OpeningFcn(hObject, eventdata, handles, varargin)
     47%------------------------------------------------------------------------
    4848% This function has no output args, see OutputFcn.
    4949% hObject    handle to figure
     
    106106set(handles.ImaDoc,'String',ext)
    107107
    108 
    109 % set(handles.ImaDoc,'String',ext)
    110  
    111108%read names of the .exe file to adjust the interface according to
    112109%available prog
     
    125122else
    126123    syst='WIN';
    127     %fid = fopen(fullfile(path_UVMAT,'PARAM_WIN.txt'),'r');%open the file with civ binary names
    128124    xmlfile=fullfile(path_UVMAT,'PARAM_WIN.xml');
    129125    if exist(xmlfile,'file')
     
    150146test_batch=1;
    151147if ~sge
    152 if isequal(todo_path,'') || isequal(todo_path,[])
    153     display(['no batch distributed processing available:file path TODO.txt not defined in UVMAT/PARAM_' syst])
    154     test_batch=0;
    155 end
    156 if exist(name_todo,'file')~=2
    157     msgbox_uvmat('WARNING',['no batch distributed processing available, queue file ' name_todo ' absent']);
    158   %  test_batch=0;  % Problems to detect file on linux/nfs filesystems
    159 end
    160 end
    161 
    162 
     148    if isequal(todo_path,'') || isequal(todo_path,[])
     149        display(['no batch distributed processing available:file path TODO.txt not defined in UVMAT/PARAM_' syst])
     150        test_batch=0;
     151    end
     152    if exist(name_todo,'file')~=2
     153        msgbox_uvmat('WARNING',['no batch distributed processing available, queue file ' name_todo ' absent']);
     154      %  test_batch=0;  % Problems to detect file on linux/nfs filesystems
     155    end
     156end
    163157if test_batch==0
    164158    set(handles.BATCH,'BackgroundColor',[0.831 0.816 0.784])% put the BATCH button in grey (unactivated)
    165159end
    166 
    167160set(handles.subdir_civ1,'String',subdir)%default subdir on which uvmat was working
    168161set(handles.subdir_civ2,'String',subdir)%default subdir on which uvmat was working
     
    215208
    216209% set the range of fields (1:1 by default) and selected pair
    217 if isempty(num2)|isequal(num2,num1)
     210if isempty(num2)||isequal(num2,num1)
    218211    num_ref_i=num1;
    219212else
     
    222215    browse.incr_pair(2)=0;
    223216end
    224 if isempty(num_b)|isequal(num_a,num_b)
     217if isempty(num_b)||isequal(num_a,num_b)
    225218    if isempty(num_a)
    226219        num_ref_j=1;
     
    248241set(handles.waitbar_patch2,'Position',[0.946 0.187 0.03 0.001])
    249242
    250 
    251 %--------------------------------------------------------------
     243%------------------------------------------------------------------------
    252244% --- Outputs from this function are returned to the command line.
    253 %-----------------------------------------------------------------
    254245function varargout = civ_OutputFcn(hObject, eventdata, handles)
     246%------------------------------------------------------------------------
    255247% varargout  cell array for returning output args (see VARARGOUT);
    256248% hObject    handle to figure
     
    260252varargout{1} = handles.output;
    261253
    262 %------------------------------------------------------------------
     254%------------------------------------------------------------------------
    263255% --- Executes on button press in browse_root.
    264256function browse_root_Callback(hObject, eventdata, handles)
     257%------------------------------------------------------------------------
    265258%get the input file properties
    266259filebase=get(handles.displ_filebase,'String');
     
    321314   end
    322315end
    323 
    324316[RootPath,RootFile,field_count,str2,str_a,str_b,ext,nom_type,subdir]=name2display(fileinput);
    325317filebase=fullfile(RootPath,RootFile);
     
    441433displ_filebase_Callback(hObject, eventdata, handles);
    442434
    443 %------------------------------------------------
    444 
     435%------------------------------------------------------------------------
    445436function ImaDoc_Callback(hObject, eventdata, handles)
     437%------------------------------------------------------------------------
    446438displ_filebase_Callback(hObject, eventdata, handles)
    447439
    448 %--------------------------------------------------------------
     440%------------------------------------------------------------------------
    449441%function activated when a new filebase (image series) is introduced
    450 %------------------------------------------------------------
    451442function displ_filebase_Callback(hObject, eventdata, handles)
    452 
     443%------------------------------------------------------------------------
    453444global test_batch
    454 %set(gcf,'Pointer','watch')
    455445set(handles.compare,'Visible','on')
    456446ext_ima=get(handles.ext_ima,'String');
     
    471461if ~isempty(browse)
    472462    if isfield(browse,'nom_type_ima')
    473         nom_type_ima=browse.nom_type_ima;
     463        nom_type_ima=browse.nom_type_ima;% get an image nomenclature type already determined by an input image name
    474464    end
    475465    if isfield(browse,'field_count')
    476         field_count=browse.field_count;
     466        field_count=browse.field_count;% get an image index type already determined by an input file
    477467    end
    478468end
     
    480470%default first_i and j and increments
    481471first_i=str2num(get(handles.first_i,'String'));%value possibly set by uvmat_Opening
    482 if isempty(first_i)| first_i < 1
     472if isempty(first_i)|| first_i < 1
    483473    first_i=1; %default first_i
    484474end
    485475last_i=str2num(get(handles.last_i,'String'));
    486 if isempty(last_i)| last_i < first_i
     476if isempty(last_i)|| last_i < first_i
    487477    last_i=first_i;  %default last_i
    488478end
     
    511501
    512502 %look for an image documentation file
    513 ext
    514503if ~isequal(ext,'.xml') && ~isequal(ext,'.civ')&& ~isequal(ext,'.avi')&& ~isequal(ext,'.AVI')
    515504    if exist([filebase '.xml'],'file')
     
    532521    drawnow
    533522    %read the image documentation file if found
    534 if isequal(ext,'.civxml') | isequal(ext,'.xml')| isequal(ext,'.civ')
     523if isequal(ext,'.civxml') || isequal(ext,'.xml')|| isequal(ext,'.civ')
    535524    set(handles.ref_i,'Visible','On')%use a reference index
    536525    set(handles.ref_j,'Visible','On')
    537526    set(handles.dt,'Visible','Off')
    538     set(handles.dt_text,'String','ref. ind.')
    539 elseif isequal(ext,'.avi') | isequal(ext,'.AVI')
     527    set(handles.dt_text,'String','')
     528elseif isequal(ext,'.avi') || isequal(ext,'.AVI')
    540529    set(handles.ref_j,'Visible','Off')
    541530    set(handles.dt,'Visible','Off')
     
    547536    set(handles.dt_text,'String','dt(ms)=')
    548537end
     538testima_xml=0;
    549539if isequal(ext,'.civxml')%TO ABANDON
    550540    [nbfield,nburst,time]=read_civxml([filebase '.civxml']);
     
    562552    ext_ima_read=[];
    563553    nom_type_read=[];
    564     XmlData.Heading
    565     if isfield(XmlData,'Heading')&&isfield(XmlData.Heading','ImageName')
     554    if isfield(XmlData,'Heading')&&isfield(XmlData.Heading','ImageName')&&ischar(XmlData.Heading.ImageName)% get image nom type and extension from the xml file
    566555        [PP,FF,fc,str2,str_a,str_b,ext_ima_read,nom_type_read]=name2display(XmlData.Heading.ImageName);
     556        fullname=fullfile(fileparts(filebase),XmlData.Heading.ImageName) %full name (including path) of the first image defined by the xmle file,
     557        if exist(fullname,'file')
     558            testima_xml=1;
     559        else
     560            msgbox_uvmat('WARNING',['FirstImage ' fullname ' defined in the xml file does not exist'])
     561        end
    567562    end
    568563    if isfield(XmlData,'Camera')
     
    606601elseif isequal(ext,'.civ')% case of .civ image documentation file
    607602        [error,time,TimeUnit,mode,npx,npy]=read_imatext([filebase '.civ']);
    608         if error==2, warndlg(['no file ' filebase '.civ']);
    609         elseif error==1, warndlg('inconsistent number of fields in the .civ file');
     603        if error==2, msgbox_uvmat('WARNING',['no file ' filebase '.civ']);
     604        elseif error==1, msgbox_uvmat('WARNING','inconsistent number of fields in the .civ file');
    610605        end
    611606%         ext_ima='.png';
     
    629624set(handles.ImaDoc,'BackgroundColor',[1 1 1])
    630625
     626%get the imabe nomenclature type if not defiend by the input file nor by the xml file
     627if isempty(nom_type_ima)
     628    %look for double image series '_i_j'
     629    dirima=dir([filebase '_' num2str(first_i) '_' num2str(first_j) '.*']);
     630    if isempty(dirima)
     631       % look for images series  with sub marker '_'
     632       dirima=dir([filebase '_*' num2str(first_i) '.*']);
     633       if isempty(dirima)
     634          % look for other images series
     635          dirima=dir([filebase '*' num2str(first_i) '.*']);
     636          if ~isempty(dirima)
     637              [pp,ff,fc,str2,str_a,str_b,ext_ima,nom_type_ima]=name2display(dirima(1).name);
     638          end
     639       else
     640           [pp,ff,fc,str2,str_a,str_b,ext_ima,nom_type_ima]=name2display(dirima(1).name);
     641       end
     642    else
     643       [pp,ff,fc,str2,str_a,str_b,ext_ima,nom_type_ima]=name2display(dirima(1).name);
     644    end
     645end   
     646   
    631647% no image documentation file found: look for a series of existing images or .nc files
    632648if isempty(time) && ~isequal(ext,'.nc')
    633         subdir=get(handles.subdir_civ1,'String');
    634         incr_pair=[0 0];%default
    635         if isfield(browse,'incr_pair')
    636                 incr_pair=browse.incr_pair;
    637         end
    638         nbdetect=0;%test of detected images
    639         field_i=field_count;
    640         idetect=1;
    641         while idetect==1 %look for the maximum file number in the series
    642                 field_i=field_i+1;
     649    subdir=get(handles.subdir_civ1,'String');
     650    incr_pair=[0 0];%default
     651    if isfield(browse,'incr_pair')
     652            incr_pair=browse.incr_pair;
     653    end
     654    nbdetect=0;%test of detected images
     655    field_i=field_count;
     656    idetect=1;
     657    while idetect==1 %look for the maximum file number in the series
     658            field_i=field_i+1;
     659            imagename=name_generator(filebase,field_i,1,ext_ima,nom_type_ima);
     660            if strcmp(nom_type_ima,'none')||strcmp(nom_type_ima,'')
     661               idetect=0; %stop if the same image is repeated (if nom_type='none')
     662               nbdetect=1;
     663            else
     664                idetect=(exist(imagename,'file')==2);
     665            end
     666            %SEE CASE OF NETCDF FILES
     667            nbdetect=nbdetect+(exist(imagename,'file')==2);
     668    end
     669    nb_field=field_i;% last detected field number
     670    field_i=field_count;%look for the minimum file number in the series
     671    idetect=1;
     672    while idetect==1
     673                field_i=field_i-1;
    643674                imagename=name_generator(filebase,field_i,1,ext_ima,nom_type_ima);
    644                 if strcmp(nom_type_ima,'none')||strcmp(nom_type_ima,'')
    645                    idetect=0; %stop if the same image is repeated (if nom_type='none')
    646                    nbdetect=1;
     675                if isequal(nom_type_ima,'none')||strcmp(nom_type_ima,'')
     676                    idetect=0; %stop if the same image is repeated (if nom_type='none')
     677                    nbdetect=1;
    647678                else
    648679                    idetect=(exist(imagename,'file')==2);
    649680                end
    650                 %SEE CASE OF NETCDF FILES
    651                 nbdetect=nbdetect+(exist(imagename,'file')==2);
    652         end
    653         nb_field=field_i;% last detected field number
    654         field_i=field_count;%look for the minimum file number in the series
    655         idetect=1;
    656         while idetect==1
    657                     field_i=field_i-1;
    658                     imagename=name_generator(filebase,field_i,1,ext_ima,nom_type_ima);
    659                     if isequal(nom_type_ima,'none')||strcmp(nom_type_ima,'')
    660                         idetect=0; %stop if the same image is repeted (if nom_type='none')
    661                         nbdetect=1;
    662                     else
    663                         idetect=(exist(imagename,'file')==2);
    664                     end
    665                     nbdetect=nbdetect+idetect;
    666         end
    667         first_i=max(field_i+1,1);
    668             %determine the set of times and possible intervals for CIV
    669         dt=(1/1000)*str2num(get(handles.dt,'String'));
    670         time=(dt*[0:nb_field-1])';
    671         set(handles.mode,'String',{'series(Di)'})
     681                nbdetect=nbdetect+idetect;
     682    end
     683    first_i=max(field_i+1,1);
     684        %determine the set of times and possible intervals for CIV
     685    dt=(1/1000)*str2num(get(handles.dt,'String'));
     686    time=(dt*[0:nb_field-1])';
     687    set(handles.mode,'String',{'series(Di)'})
    672688end
    673689if isequal(nom_type_ima,'none')% no file numbering used
     
    683699        set(handles.displ_filebase,'UserData',time); %store the set of times
    684700        if isempty(TimeUnit)
    685             set(handles.dt_unit,'String','e-03');
     701            set(handles.dt_unit,'String','dt in e-03');
    686702            set(handles.TimeUnit,'String','');
    687703        else
    688             set(handles.dt_unit,'String',['m' TimeUnit]);
     704            set(handles.dt_unit,'String',['dt in m' TimeUnit]);
    689705            set(handles.TimeUnit,'String',TimeUnit);
    690706        end
     
    780796set(gcf,'Pointer','arrow')
    781797
    782 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%????????????
     798%------------------------------------------------------------------------
    783799% --- Executes on button press in mode.
    784 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    785800function mode_Callback(hObject, eventdata, handles)
     801%------------------------------------------------------------------------
    786802browse=get(handles.browse_root,'UserData');
    787 
    788803compare_list=get(handles.compare,'String');
    789804val=get(handles.compare,'Value');
     
    813828    displ_dt=1;%default
    814829    nbfield2=min(nbfield2,10);%limitate the number of pairs to 10x10
    815 %     if nbfield2<2
    816 %         nbfield2=2,
    817 %     end
    818830    for numod_a=1:nbfield2-1 %nbfield2 always >=2 for 'pair j1-j2' mode
    819831        for numod_b=(numod_a+1):nbfield2
     
    938950find_netcpair_civ2(hObject, eventdata, handles)
    939951
    940 %--------------------------------------------------------------
     952%------------------------------------------------------------------------
    941953% determine the menu for civ1 pairs depending on existing netcdf file at the middle of
    942954% the field series set by first_i, incr, last_i
    943 %----------------------------------------------------------------
    944955function find_netcpair_civ1(hObject, eventdata, handles)
     956%------------------------------------------------------------------------
    945957set(gcf,'Pointer','watch')
    946958%nomenclature types
     
    971983end
    972984if isempty(nom_type_nc)
    973     'TESTciv'
    974     nom_type_ima
    975985     [nom_type_nc]=nomtype2pair(nom_type_ima,isequal(mode,'series(Di)'),isequal(mode,'series(Dj)'));
    976986end
     
    9931003else
    9941004    ref_j=str2num(get(handles.ref_j,'String'));
    995 end
    996 if isequal(get(handles.dt_text,'String'),'dt(ms)=')%simple series(Di) with equal interval
    997     ref_i=floor((first_i+last_i)/2);
    998     ref_j=1;
    9991005end
    10001006time=get(handles.displ_filebase,'UserData');%get the set of times
     
    11271133set(handles.list_pair_civ2,'String',displ_pair');
    11281134set(gcf,'Pointer','arrow')
    1129 %--------------------------------------------------------------
     1135
     1136%------------------------------------------------------------------------
    11301137% determine the menu for civ2 pairs depending on the existing netcdf file at the
    11311138%middle of the series set by first_i, incr, last_i
    1132 %--------------------------------------------------------------
    11331139function find_netcpair_civ2(hObject, eventdata, handles)
     1140%------------------------------------------------------------------------
    11341141set(gcf,'Pointer','watch')
    11351142%nomenclature types
     
    12651272          end
    12661273       end
    1267 %    else
    1268 %        for ipair=1:nbpair
    1269 %          if select(ipair)
    1270 %             displ_pair{ipair}=['Di= ' num2str(-floor(ipair/2)) '|' num2str(ceil(ipair/2)) ' :dt= ' num2str(dt_unit*ipair)];
    1271 %          else
    1272 %             displ_pair{ipair}='...'; %pair not displayed in the menu
    1273 %          end
    1274 %        end
    1275 %     end
    12761274elseif isequal(mode,'series(Dj)') %| isequal(mode,'st_series(Dj)') % series on the j index
    12771275       for ipair=1:nbpair
     
    13101308end
    13111309set(handles.list_pair_civ2,'String',displ_pair');
    1312 
    1313 
    13141310set(gcf,'Pointer','arrow')
    1315 %----------------------------------------------------
     1311
     1312%------------------------------------------------------------------------
    13161313%  determine the list of index pairs of processing file
    1317 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    13181314function [num1_civ1,num2_civ1,num_a_civ1,num_b_civ1,num1_civ2,num2_civ2,num_a_civ2,num_b_civ2]=...
    13191315    find_pair_indices(handles,mode)
     1316%------------------------------------------------------------------------
    13201317first_i=str2num(get(handles.first_i,'String'));
    13211318last_i=str2num(get(handles.last_i,'String'));
     
    14591456end
    14601457
    1461 
    1462 %-------------------------------------------------------------
     1458%------------------------------------------------------------------------
    14631459% --- Executes on selection change in list_pair_civ1.
    14641460function list_pair_civ1_Callback(hObject, eventdata, handles)
    1465 %------------------------------------------------------------
     1461%------------------------------------------------------------------------
    14661462%reproduce by default the chosen pair in the civ2 menu
    14671463list_pair=get(handles.list_pair_civ1,'String');%get the menu of image pairs
     
    15071503end
    15081504
    1509 %------------------------------------------------------------------
     1505%------------------------------------------------------------------------
    15101506% --- Executes on selection change in list_pair_civ2.
    15111507function list_pair_civ2_Callback(hObject, eventdata, handles)
    1512 
     1508%------------------------------------------------------------------------
    15131509index_pair=get(handles.list_pair_civ2,'Value');%get the selected position index in the menu
    15141510
     
    15451541end
    15461542
    1547 %---------------------------------------------------
     1543%------------------------------------------------------------------------
    15481544% --- Executes on button press in RUN.
    1549 %------------------------------------------------------
    15501545function RUN_Callback(hObject, eventdata, handles)
     1546%------------------------------------------------------------------------
    15511547global civ1_exe civ2_exe patch_exe patch_new_exe sge
    15521548
     
    15831579%check mask if selecetd
    15841580if isequal(get(handles.get_mask_civ1,'Value'),1)
    1585      get_mask_civ1_Callback(hObject, eventdata, handles);
     1581    maskname=get(handles.mask_civ1,'String');
     1582    if ~exist(maskname,'file')
     1583        get_mask_civ1_Callback(hObject, eventdata, handles);
     1584    end
    15861585end
    15871586if isequal(get(handles.get_mask_fix1,'Value'),1)
     1587    maskname=get(handles.mask_fix1,'String');
     1588    if ~exist(maskname,'file')
    15881589     get_mask_fix1_Callback(hObject, eventdata, handles);
     1590    end
    15891591end
    15901592if isequal(get(handles.get_mask_civ2,'Value'),1)
     1593    maskname=get(handles.mask_civ2,'String');
     1594    if ~exist(maskname,'file')
    15911595     get_mask_civ2_Callback(hObject, eventdata, handles);
     1596    end
    15921597end
    15931598if isequal(get(handles.get_mask_fix2,'Value'),1)
     1599    maskname=get(handles.mask_fix2,'String');
     1600    if ~exist(maskname,'file')
    15941601     get_mask_fix2_Callback(hObject, eventdata, handles);
     1602    end
    15951603end
    15961604
     
    16511659[filecell,num1_civ1,num2_civ1,num_a_civ1,num_b_civ1,num1_civ2,num2_civ2,num_a_civ2,num_b_civ2,nom_type_nc,file_ref_fix1,file_ref_fix2]=...
    16521660       set_civ_filenames(handles,compare,box_test);
     1661if isempty(filecell)
     1662   set(handles.RUN, 'Enable','On')
     1663    set(handles.RUN,'BackgroundColor',[1 0 0])
     1664    set(handles.BATCH, 'Enable','On')
     1665    set(handles.BATCH,'BackgroundColor',[1 0 0])
     1666   return
     1667end
    16531668display('files OK, processing...')   
    16541669nbfield=size(num1_civ1,2);
     
    16881703    end   
    16891704    h = waitbar(0,['removing velocity vectors, fix1']);% display a wait bar
    1690     test_mask=get(handles.get_mask_fix1,'Value');
    1691     maskdispl=get(handles.mask_fix1,'String');
    1692     maskbase=[get(handles.displ_filebase,'String') '_' maskdispl]; % mask root name
     1705    test_mask=get(handles.get_mask_fix1,'Value');   
     1706    if test_mask
     1707        maskdispl=get(handles.mask_fix1,'String');
     1708        if exist(maskdispl,'file')
     1709            test_mask=2;
     1710            maskname=maskdispl;
     1711        else
     1712            maskbase=[get(handles.displ_filebase,'String') '_' maskdispl]; % mask root name
     1713        end
     1714    end
    16931715    for ifile=1:nbfield
    16941716        waitbar(ifile/nbfield); %update the waitbar
     
    16971719                maskname='noFile use default';
    16981720                maskflag=0;
    1699             else
     1721            elseif test_mask==1
    17001722                nbslice_mask=str2num(maskdispl(1:end-4)); %
    17011723                num1_mask=mod(num1_civ1(ifile)-1,nbslice_mask)+1;
     
    18381860    h = waitbar(0,['removing velocity vectors, fix2']);% display a wait bar
    18391861    test_mask=get(handles.get_mask_fix2,'Value');
    1840     maskdispl=get(handles.mask_fix2,'String');
    1841     maskbase=[get(handles.displ_filebase,'String') '_' maskdispl]; % mask root name
     1862    if test_mask
     1863        maskdispl=get(handles.mask_fix2,'String');
     1864        if exist(maskdispl,'file')
     1865            test_mask=2;
     1866            maskname=maskdispl;
     1867        else
     1868            maskbase=[get(handles.displ_filebase,'String') '_' maskdispl]; % mask root name
     1869        end
     1870    end
    18421871    for ifile=1:nbfield
    18431872        waitbar(ifile/nbfield); %update the waitbar
     
    18461875                maskname='noFile use default';
    18471876                maskflag=0;
    1848            else
     1877           elseif test_mask==1
    18491878                nbslice_mask=str2num(maskdispl(1:end-4)); %
    18501879                num1_mask=mod(num1_civ2(ifile)-1,nbslice_mask)+1;
     
    19842013saveas(gcbf,namefigfull);%save the interface with name namefigfull (A CHANGER EN FICHIER  .xml)
    19852014
    1986 
    1987 %-----------------------------------------------------------
     2015%------------------------------------------------------------------------
    19882016% --- Executes on button press in BATCH: remote processing
    1989 %-----------------------------------------------------------
    19902017function BATCH_Callback(hObject, eventdata, handles)
     2018%------------------------------------------------------------------------
    19912019global civ1_exe civ2_exe patch_exe patch_new_exe fix_exe todo_path sge Civ_exe
    19922020compare=get(handles.compare,'Value');%test for usual PIV (compare=1) or displacement (=2) or stereo PIV (=3)
     
    20242052%check mask if selecetd
    20252053if isequal(get(handles.get_mask_civ1,'Value'),1)
    2026      get_mask_civ1_Callback(hObject, eventdata, handles);
     2054    maskname=get(handles.mask_civ1,'String');
     2055    if ~exist(maskname,'file')
     2056        get_mask_civ1_Callback(hObject, eventdata, handles);
     2057    end
    20272058end
    20282059if isequal(get(handles.get_mask_fix1,'Value'),1)
    2029      get_mask_fix1_Callback(hObject, eventdata, handles);
     2060    maskname=get(handles.mask_fix1,'String');
     2061    if ~exist(maskname,'file')
     2062        get_mask_fix1_Callback(hObject, eventdata, handles);
     2063    end
    20302064end
    20312065if isequal(get(handles.get_mask_civ2,'Value'),1)
     2066    maskname=get(handles.mask_civ2,'String');
     2067    if ~exist(maskname,'file')
    20322068     get_mask_civ2_Callback(hObject, eventdata, handles);
     2069    end
    20332070end
    20342071if isequal(get(handles.get_mask_fix2,'Value'),1)
     2072    maskname=get(handles.mask_fix2,'String');
     2073    if ~exist(maskname,'file')
    20352074     get_mask_fix2_Callback(hObject, eventdata, handles);
     2075    end
    20362076end
    20372077
     
    22752315        cmd='';
    22762316        if sge
     2317           %fid=fopen([filename '.cmx'],'w')
    22772318           cmd='#!/bin/bash';
    2278            cmd=char({cmd;'#$ -cwd'});
    2279            cmd=char({cmd;'hostname && date'});
     2319           cmd=[cmd '\n' '#$ -cwd'];
     2320           cmd=[cmd '\n' 'hostname && date'];
    22802321        end
    22812322        if civAll
     
    23072348            else
    23082349                maskdispl=get(handles.mask_civ1,'String');
    2309                 maskbase=[filebase '_' maskdispl]; %
    2310                 nbslice_mask=str2num(maskdispl(1:end-4)); %
    2311                 num1_mask=mod(num1_civ1(ifile)-1,nbslice_mask)+1;
    2312                 par_civ1.maskname=name_generator(maskbase,num1_mask,1,'.png','_i');
    2313                 if exist(par_civ1.maskname,'file')
    2314                     par_civ1.maskflag='y';
     2350                if exist(maskdispl,'file')
     2351                    par_civ1.maskname=maskdispl;
     2352                    par_civ1.maskflag='y';   
    23152353                else
    2316                     par_civ1.maskname='noFile use default';
    2317                     par_civ1.maskflag='n';
     2354                    maskbase=[filebase '_' maskdispl]; %
     2355                    nbslice_mask=str2num(maskdispl(1:end-4)); %
     2356                    num1_mask=mod(num1_civ1(ifile)-1,nbslice_mask)+1;
     2357                    par_civ1.maskname=name_generator(maskbase,num1_mask,1,'.png','_i');
     2358                    if exist(par_civ1.maskname,'file')
     2359                        par_civ1.maskflag='y';
     2360                    else
     2361                        par_civ1.maskname='noFile use default';
     2362                        par_civ1.maskflag='n';
     2363                    end
    23182364                end
    23192365            end
     
    23462392            i_cmd=i_cmd+1;
    23472393            if isequal(civAll,0)
    2348                 cmd=char({cmd;BATCH_CIV1(filename_cmx([1:end-4]),namelog,par_civ1,handles)});
     2394                cmd=[cmd '\n' BATCH_CIV1(filename_cmx(1:end-4),namelog,par_civ1,handles)];
    23492395            else
    23502396                 civAllCmd=[civAllCmd ' civ1 '];
     
    23782424                   ' -fi2 ' num2str(flagindex1(2)) ' -fi3 ' num2str(flagindex1(3)) ...
    23792425                   ' -threshC ' num2str(thresh_vecC1) ' -threshV ' num2str(thresh_vel1) ' -maskName ' maskname];
    2380            cmd=char({cmd ;cmd_FIX});
     2426           cmd=[cmd '\n' cmd_FIX];
    23812427           else
    23822428                fix1.inputFileName=filecell.nc.civ1{ifile,j} ;
     
    24032449        if isequal(civAll,0)
    24042450            cmd_PATCH=RUN_PATCH(filecell.nc.civ1{ifile,j},nx_patch1,ny_patch1,rho_patch1,subdomain_patch1,thresh_patch1,test_interp);
    2405             cmd=char({cmd ;cmd_PATCH});
     2451            cmd=[cmd '\n' cmd_PATCH];
    24062452        else
    24072453            patch1.inputFileName=filecell.nc.civ1{ifile,j} ;
     
    24712517            else
    24722518                maskdispl=get(handles.mask_civ2,'String');
    2473                 maskbase=[filebase '_' maskdispl]; %
    2474                 nbslice_mask=str2num(maskdispl(1:end-4)); %
    2475                 num1_mask=mod(num1_civ2(ifile)-1,nbslice_mask)+1;
    2476                 par_civ2.maskname=name_generator(maskbase,num1_mask,1,'.png','_i');
    2477                 if exist(par_civ2.maskname,'file')
    2478                     par_civ2.maskflag='y';
     2519                if exist(maskdispl,'file')
     2520                    par_civ2.maskname=maskdispl;
     2521                    par_civ2.maskflag='y';
    24792522                else
    2480                     par_civ2.maskname='noFile use default';
    2481                     par_civ2.maskflag='n';
     2523                    maskbase=[filebase '_' maskdispl]; %
     2524                    nbslice_mask=str2num(maskdispl(1:end-4)); %
     2525                    num1_mask=mod(num1_civ2(ifile)-1,nbslice_mask)+1;
     2526                    par_civ2.maskname=name_generator(maskbase,num1_mask,1,'.png','_i');
     2527                    if exist(par_civ2.maskname,'file')
     2528                        par_civ2.maskflag='y';
     2529                    else
     2530                        par_civ2.maskname='noFile use default';
     2531                        par_civ2.maskflag='n';
     2532                    end
    24822533                end
    24832534            end
     
    25102561            if isequal(civAll,0)
    25112562                if(isunix)
    2512                     cmd=char({cmd ; ['cp -f ' filename_cmx '2 ' filename_cmx]; cmd_CIV2});
     2563                    cmd=[cmd '\n' 'cp -f ' filename_cmx '2 ' filename_cmx '\n' cmd_CIV2];
    25132564                else
    2514                     cmd=char({cmd ; ['copy /Y ' filename_cmx '2 ' filename_cmx]; cmd_CIV2});
     2565                    cmd=[cmd '\n' 'copy /Y ' filename_cmx '2 ' filename_cmx '\n' cmd_CIV2];
    25152566                end
    25162567            else
     
    25302581     
    25312582     % FIX2
    2532        if box_test(5)==1
     2583     if box_test(5)==1
    25332584           test_mask=get(handles.get_mask_fix2,'Value');   
    25342585            if test_mask==0 
     
    25452596                   ' -fi2 ' num2str(flagindex2(2)) ' -fi3 ' num2str(flagindex2(3)) ...
    25462597                   ' -threshC ' num2str(thresh_vec2C) ' -threshV ' num2str(thresh_vel2) ' -maskName ' maskname];
    2547                 cmd=char({cmd ;cmd_FIX});
     2598                cmd=[cmd '\n' cmd_FIX];
    25482599           else                     
    25492600                fix2.inputFileName=filecell.nc.civ2{ifile,j} ;
     
    25672618       
    25682619     %PATCH2
    2569     if box_test(6)==1
    2570         if isequal(civAll,0)
    2571             cmd_PATCH=RUN_PATCH(filecell.nc.civ2{ifile,j},nx_patch2,ny_patch2,rho_patch2,subdomain_patch2,thresh_patch2,test_interp);
    2572             cmd=char({cmd; cmd_PATCH});
     2620       if box_test(6)==1
     2621            if isequal(civAll,0)
     2622                cmd_PATCH=RUN_PATCH(filecell.nc.civ2{ifile,j},nx_patch2,ny_patch2,rho_patch2,subdomain_patch2,thresh_patch2,test_interp);
     2623                cmd=[cmd '\n' cmd_PATCH];
     2624            else
     2625                patch2.inputFileName=filecell.nc.civ1{ifile,j} ;
     2626                patch2.nopt=subdomain_patch1;
     2627                patch2.maxdiff=thresh_patch1;
     2628                patch2.ro=rho_patch1;
     2629                test_grid=get(handles.get_gridpatch2,'Value');
     2630                if test_grid
     2631                    patch2.gridflag='y';
     2632                    gridname=get(handles.grid_patch2,'String');
     2633                    if isequal(gridname(end-3:end),'grid')
     2634                        nbslice_grid=str2num(gridname(1:end-4)); %
     2635                        if ~isempty(nbslice_grid)
     2636                            num1_grid=mod(num1_civ2(ifile)-1,nbslice_grid)+1;
     2637                            patch2.gridPatch=[filebase '_' name_generator(gridname,num1_grid,1,'.grid','_i')];
     2638                            if ~exist(patch2.gridPatch,'file')
     2639                               msgbox_uvmat('ERROR','grid file absent for patch2')
     2640                            end
     2641                        elseif exist(gridname,'file')
     2642                            patch2.gridPatch=gridname;
     2643                        else
     2644                            msgbox_uvmat('ERROR','grid file absent for patch2')
     2645                        end
     2646                    end
     2647                else
     2648                      patch2.gridPatch='n';
     2649                      patch2.gridflag='n';
     2650                      patch2.m=nx_patch2;
     2651                      patch2.n=ny_patch2;
     2652                end
     2653                patch2.convectFlow='n';
     2654                fieldnames=fields(patch2);
     2655                [civAllxml,uid_patch2]=add(civAllxml,1,'element','patch2');
     2656                for ilist=1:length(fieldnames)
     2657                   val=eval(['patch2.' fieldnames{ilist}]);
     2658                   if ischar(val)
     2659                      [civAllxml,uid_t]=add(civAllxml,uid_patch2,'element',fieldnames{ilist});
     2660                      [civAllxml,uid_t2]=add(civAllxml,uid_t,'chardata',val);
     2661                   end
     2662                end             
     2663                civAllCmd=[civAllCmd ' patch2 '];
     2664            end     
     2665        end
     2666        if isequal(civAll,1)
     2667            save(civAllxml,[filename_cmx([1:end-4]) '.xml']);
     2668            cmd=char({cmd;[Civ_exe ' -f ' [filename_cmx([1:end-4]) '.xml'] ' ' civAllCmd]});
     2669        end
     2670
     2671      % create the .bat file:
     2672        if sge
     2673                [Rootbat,Filebat,extbat]=fileparts(filename_cmx);
     2674                filename_bat=fullfile(Rootbat,['job_' Filebat extbat]);
    25732675        else
    2574             patch2.inputFileName=filecell.nc.civ1{ifile,j} ;
    2575             patch2.nopt=subdomain_patch1;
    2576             patch2.maxdiff=thresh_patch1;
    2577             patch2.ro=rho_patch1;
    2578             test_grid=get(handles.get_gridpatch2,'Value');
    2579             if test_grid
    2580                  patch2.gridflag='y';
    2581                 gridname=get(handles.grid_patch2,'String');
    2582                 if isequal(gridname(end-3:end),'grid')
    2583                     nbslice_grid=str2num(gridname(1:end-4)); %
    2584                     if ~isempty(nbslice_grid)
    2585                         num1_grid=mod(num1_civ2(ifile)-1,nbslice_grid)+1;
    2586                         patch2.gridPatch=[filebase '_' name_generator(gridname,num1_grid,1,'.grid','_i')];
    2587                         if ~exist(patch2.gridPatch,'file')
    2588                            msgbox_uvmat('ERROR','grid file absent for patch2')
    2589                         end
    2590                     elseif exist(gridname,'file')
    2591                         patch2.gridPatch=gridname;
    2592                     else
    2593                         msgbox_uvmat('ERROR','grid file absent for patch2')
    2594                     end
    2595                 end
     2676            filename_bat=filename_cmx;
     2677        end
     2678        filename_bat(end-2:end)='bat';
     2679        fid=fopen(filename_bat,'w');
     2680        fprintf(fid,cmd)
     2681        fclose(fid)
     2682        %dlmwrite(filename_bat,cmd,'');%write commands in filename_bat
     2683        if sge
     2684            pvalue=num2str((1-ind_answer)*500);
     2685            namelog=[filename_bat '.patch.log'];
     2686            ['!qsub -p ' pvalue ' -q civ.q -e ' filename_cmx(1:end-4) '.errors -o ' filename_cmx(1:end-4) '.log' ' ' filename_bat];
     2687            eval(  ['!qsub -p ' pvalue ' -q civ.q -e ' filename_cmx(1:end-4) '.errors -o ' filename_cmx(1:end-4) '.log' ' ' filename_bat]);
     2688        else
     2689            if(isunix)
     2690              cmdtodo=['. ' filename_bat ];%removed for Mathieu tests %' && rm -f ' filename_bat] ;
    25962691            else
    2597                   patch2.gridPatch='n';
    2598                   patch2.gridflag='n';
    2599                   patch2.m=nx_patch2;
    2600                   patch2.n=ny_patch2;
     2692               cmdtodo=[filename_bat];%removed for Mathieu tests %' && del /F /Q ' filename_bat' ;
    26012693            end
    2602             patch2.convectFlow='n';
    2603             fieldnames=fields(patch2);
    2604             [civAllxml,uid_patch2]=add(civAllxml,1,'element','patch2');
    2605             for ilist=1:length(fieldnames)
    2606                val=eval(['patch2.' fieldnames{ilist}]);
    2607                if ischar(val)
    2608                   [civAllxml,uid_t]=add(civAllxml,uid_patch2,'element',fieldnames{ilist});
    2609                   [civAllxml,uid_t2]=add(civAllxml,uid_t,'chardata',val);
    2610                end
    2611             end             
    2612             civAllCmd=[civAllCmd ' patch2 '];
    2613         end     
    2614     end
    2615     if isequal(civAll,1)
    2616          civAllxml
    2617         save(civAllxml,[filename_cmx([1:end-4]) '.xml']);
    2618         cmd=char({cmd;[Civ_exe ' -f ' [filename_cmx([1:end-4]) '.xml'] ' ' civAllCmd]});
     2694            count= fprintf(p1,'%s\n', cmdtodo);
     2695        end
    26192696     end
    2620              
    2621   % create the .bat file:
    2622         if sge
    2623                 [Rootbat,Filebat,extbat]=fileparts(filename_cmx);
    2624                 filename_bat=fullfile(Rootbat,['job_' Filebat extbat]);
    2625         else
    2626                 filename_bat=filename_cmx;
    2627         end
    2628   filename_bat(end-2:end)='bat';
    2629 
    2630     dlmwrite(filename_bat,cmd,'');%write commands in filename_bat
    2631     if sge
    2632         pvalue=num2str((1-ind_answer)*500);
    2633         namelog=[filename_bat '.patch.log'];
    2634         ['!qsub -p ' pvalue ' -q civ.q -e ' filename_cmx(1:end-4) '.errors -o ' filename_cmx(1:end-4) '.log' ' ' filename_bat];
    2635         eval(  ['!qsub -p ' pvalue ' -q civ.q -e ' filename_cmx(1:end-4) '.errors -o ' filename_cmx(1:end-4) '.log' ' ' filename_bat]);
    2636     else
    2637         if(isunix)
    2638           cmdtodo=['. ' filename_bat ];%removed for Mathieu tests %' && rm -f ' filename_bat] ;
    2639         else
    2640            cmdtodo=[filename_bat];%removed for Mathieu tests %' && del /F /Q ' filename_bat' ;
    2641         end
    2642         count= fprintf(p1,'%s\n', cmdtodo);
    2643     end
    2644  end
    26452697end
    26462698if ~sge
     
    26762728saveas(gcbf,namefigfull);%save the interface with name namefigfull (A CHANGER EN FICHIER  .xml)
    26772729
    2678 
    2679 %----------------------------------------------------------
     2730%------------------------------------------------------------------------
    26802731%OUTPUT:
    26812732% filecell: structure of input and output files
     
    26872738%         .ncA.civ1{i,j}, .ncA.civ2{i,j}; set of nc files for PIV results with camA (then .nc corresponds to camB)
    26882739%         .st{i,j};   set of nc files for the combined stereo fields
    2689 
    26902740function [filecell,num1_civ1,num2_civ1,num_a_civ1,num_b_civ1,num1_civ2,num2_civ2,num_a_civ2,num_b_civ2,nom_type_nc,file_ref_fix1,file_ref_fix2]=...
    26912741    set_civ_filenames(handles,compare,box_test)
    2692 
     2742%------------------------------------------------------------------------
    26932743%get the filename root, nomenclature and numbers
    26942744filebase=get(handles.displ_filebase,'String');
     
    27952845                if ~exist(file_ref,'file')
    27962846                    msgbox_uvmat('ERROR',['reference file ' file_ref ' not found for fix1'])
    2797                     set(handles.RUN, 'Enable','On')
    2798                     set(handles.RUN,'BackgroundColor',[1 0 0])
    2799                     set(handles.BATCH, 'Enable','On')
    2800                     set(handles.BATCH,'BackgroundColor',[1 0 0])
     2847                    filecell=[];
    28012848                    return
    28022849                end
     
    28492896                if ~exist(file_ref,'file')
    28502897                    msgbox_uvmat('ERROR',['reference file ' file_ref ' not found for fix2'])
    2851                     set(handles.RUN, 'Enable','On')
    2852                     set(handles.RUN,'BackgroundColor',[1 0 0])
    2853                     set(handles.BATCH, 'Enable','On')
    2854                     set(handles.BATCH,'BackgroundColor',[1 0 0])
     2898                    filecell=[];
    28552899                    return
    28562900                end
     
    28682912[Path_ima,Name]=fileparts(filebase);%Path of the image files (.civ)
    28692913if ~exist(Path_ima,'dir')
    2870     warndlg_uvmat(['path to images ' Path_ima ' not found'],'ERROR')
     2914    msgbox_uvmat('ERROR',['path to images ' Path_ima ' not found'])
     2915    filecell=[];
    28712916    return
    28722917end
     
    28772922if ~isempty(message) & ~isequal(message.UserWrite,1)
    28782923      msgbox_uvmat('ERROR',['No writting access to ' Path_ima])
     2924      filecell=[];
    28792925      cd(currentdir);
    28802926      return
     
    29472993          if idetectmin==0,
    29482994                msgbox_uvmat('ERROR',[filecell.ima1.civ1{ifile,indexj} ' not found'])
    2949                 set(handles.RUN, 'Enable','On')
    2950                 set(handles.RUN,'BackgroundColor',[1 0 0])
    2951                 set(handles.BATCH, 'Enable','On')
    2952                 set(handles.BATCH,'BackgroundColor',[1 0 0])
    2953                 cd(currentdir)
     2995                filecell=[];
    29542996                return
    29552997          end
     
    29572999          if idetectmin==0,
    29583000                msgbox_uvmat('ERROR',[filecell.ima2.civ1{ifile,indexj} ' not found'])
    2959                 set(handles.RUN, 'Enable','On')
    2960                 set(handles.RUN,'BackgroundColor',[1 0 0])
    2961                 set(handles.BATCH, 'Enable','On')
    2962                 set(handles.BATCH,'BackgroundColor',[1 0 0])
     3001                filecell=[];
    29633002                cd(currentdir)
    29643003                return
     
    29783017              if idetectmin==0,
    29793018                    msgbox_uvmat('ERROR',[filecell.imaA1.civ1{ifile,indexj} ' not found'])
    2980                     set(handles.RUN, 'Enable','On')
    2981                     set(handles.RUN,'BackgroundColor',[1 0 0])
    2982                     set(handles.BATCH, 'Enable','On')
    2983                     set(handles.BATCH,'BackgroundColor',[1 0 0])
    2984                       cd(currentdir)
    2985                       return
     3019                    filecell=[];
     3020                    cd(currentdir)
     3021                    return
    29863022              end
    29873023               [idetectmin,indexj]=min(idetect_1);
    29883024               if idetectmin==0,
    2989                     msgbox_uvmat('ERROR',[filecell.imaA2.civ1{ifile,indexj} ' not found'])
    2990                     set(handles.RUN, 'Enable','On')
    2991                     set(handles.RUN,'BackgroundColor',[1 0 0])
    2992                     set(handles.BATCH, 'Enable','On')
    2993                     set(handles.BATCH,'BackgroundColor',[1 0 0])
    2994                     cd(currentdir)
    2995                     return
     3025                   msgbox_uvmat('ERROR',[filecell.imaA2.civ1{ifile,indexj} ' not found'])
     3026                  filecell=[];
     3027                  cd(currentdir)
     3028                  return
    29963029               end
    29973030         end
     
    30193052                        set(handles.BATCH, 'Enable','On')
    30203053                    set(handles.BATCH,'BackgroundColor',[1 0 0])
     3054                    filecell=[];
    30213055                        cd(currentdir)
    30223056                        return
     
    30963130                if ~exist(filename,'file')
    30973131                    msgbox_uvmat('ERROR',['input file ' filename ' not found'])
    3098                     set(handles.RUN, 'Enable','On')
    3099                     set(handles.RUN,'BackgroundColor',[1 0 0])
    3100                      set(handles.BATCH, 'Enable','On')
    3101                     set(handles.BATCH,'BackgroundColor',[1 0 0])
     3132                  filecell=[];
    31023133                    return
    31033134                end
     
    31073138                        if isempty(Data.civ2)||isequal(Data.civ2,0)
    31083139                            msgbox_uvmat('ERROR',['no civ2 data in ' filename])
    3109                             set(handles.RUN, 'Enable','On')
    3110                             set(handles.RUN,'BackgroundColor',[1 0 0])
    3111                             set(handles.BATCH, 'Enable','On')
    3112                             set(handles.BATCH,'BackgroundColor',[1 0 0])
     3140                            filecell=[];
    31133141                            return
    31143142                        end 
     
    31173145                        if isempty(Data.patch)||isequal(Data.patch,0)
    31183146                            msgbox_uvmat('ERROR',['no patch data in ' filename])
    3119                             set(handles.RUN, 'Enable','On')
    3120                             set(handles.RUN,'BackgroundColor',[1 0 0])
    3121                             set(handles.BATCH, 'Enable','On')
    3122                             set(handles.BATCH,'BackgroundColor',[1 0 0])
     3147                            filecell=[];
    31233148                            return
    31243149                        end
     
    31703195            if idetectmin==0,
    31713196                    msgbox_uvmat('ERROR',['input image ' filecell.ima1.civ2{ifile,indexj} ' not found'])
    3172                     set(handles.RUN, 'Enable','On')
    3173                     set(handles.RUN,'BackgroundColor',[1 0 0])
    3174                            set(handles.BATCH, 'Enable','On')
    3175                     set(handles.BATCH,'BackgroundColor',[1 0 0])
     3197                    filecell=[];
    31763198                    return
    31773199            end
     
    31923214            if idetectmin==0,
    31933215                    msgbox_uvmat('ERROR',['input image ' filecell.ima2.civ2{ifile,indexj} ' not found'])
    3194                     set(handles.RUN, 'Enable','On')
    3195                     set(handles.RUN,'BackgroundColor',[1 0 0])
    3196                            set(handles.BATCH, 'Enable','On')
    3197                     set(handles.BATCH,'BackgroundColor',[1 0 0])
     3216                    filecell=[];
    31983217                    return
    31993218            end
     
    32123231                if ~exist(filename,'file')
    32133232                    msgbox_uvmat('ERROR',['input file ' filename ' not found'])
    3214                     set(handles.RUN, 'Enable','On')
    3215                     set(handles.RUN,'BackgroundColor',[1 0 0])
    3216                     set(handles.BATCH, 'Enable','On')
    3217                     set(handles.BATCH,'BackgroundColor',[1 0 0])
     3233                    filecell=[];
    32183234                    return
    32193235                else
     
    32213237                    if isempty(Data.civ2)||isequal(Data.civ2,0)         
    32223238                        msgbox_uvmat('ERROR',['no civ2 data in ' filename])
    3223                         set(handles.RUN, 'Enable','On')
    3224                         set(handles.RUN,'BackgroundColor',[1 0 0])
    3225                         set(handles.BATCH, 'Enable','On')
    3226                         set(handles.BATCH,'BackgroundColor',[1 0 0])
     3239                        filecell=[];
    32273240                        return
    32283241                    end
     
    33253338end
    33263339
    3327 %---------------------------------------------------------
     3340%------------------------------------------------------------------------
    33283341%CIV1  CIV1  CIV1 CIV1
    3329 %----------------------------------------------------------
    33303342function RUN_CIV1(handles,filecell,filecell_1,filecell_nc1,num1,num2,num_a,num_b,nom_type_nc)
     3343%------------------------------------------------------------------------
    33313344%pixels per cm and matrix of the image times, read from the .civ file by uvmat
    33323345global civ1_exe sge%name of the executable for civ1 calculation
     
    34903503                'ImageUsedBefore null null'};
    34913504                textout=char(textcmx);
    3492                 dlmwrite(filename_cmx,textout,'');
     3505%               dlmwrite(filename_cmx,textout,'');
     3506       
     3507       
     3508     fid=fopen([filename_cmx],'w');
     3509fprintf(fid, ['##############   CMX file' '\n']);
     3510 fprintf(fid,   ['FirstImage ' filename_ima '\n' ]);
     3511 fprintf(fid,   ['LastImage  ' filename_ima_1 '\n' ]);
     3512  fprintf(fid,  ['XX' '\n' ]);
     3513  fprintf(fid,  ['Mask '  maskflag '\n' ]);
     3514  fprintf(fid,  ['MaskName '  maskname '\n' ]);
     3515 fprintf(fid,   ['ImageSize '  npx ' '  npy '\n' ]);   %VERIFIER CAS GENERAL ?
     3516 fprintf(fid,   ['CorrelationBoxesSize '  ibx ' '  iby '\n' ]);
     3517 fprintf(fid,   ['SearchBoxeSize '  isx ' '  isy '\n' ]);
     3518 fprintf(fid,   ['RO '  rho '\n' ]);
     3519 fprintf(fid,   ['GridSpacing '  dx ' '  dy '\n' ]);
     3520 fprintf(fid,   ['XX 1.0' '\n' ]);
     3521 fprintf(fid,   ['Dt_TO '  Dt ' '  T0 '\n' ]);
     3522  fprintf(fid,  ['PixCmXY '  pxcmx ' '  pxcmy '\n' ]);
     3523  fprintf(fid,  ['XX 1' '\n' ]);
     3524 fprintf(fid,   ['ShiftXY '  shiftx ' '   shifty '\n' ]);
     3525  fprintf(fid,  ['Grid '  gridflag '\n' ]);
     3526 fprintf(fid,   ['GridName '  gridname '\n' ]);
     3527 fprintf(fid,   ['XX 85' '\n' ]);
     3528 fprintf(fid,   ['XX 1.0' '\n' ]);
     3529 fprintf(fid,   ['XX 1.0' '\n' ]);
     3530 fprintf(fid,   ['Hart 1' '\n' ]);
     3531 fprintf(fid,  [ 'DecimalShift 0' '\n' ]);
     3532 fprintf(fid,   ['Deformation 0' '\n' ]);
     3533  fprintf(fid,  ['CorrelationMin 0' '\n' ]);
     3534 fprintf(fid,   ['IntensityMin 0' '\n' ]);
     3535  fprintf(fid,  ['SeuilImage n' '\n' ]);
     3536 fprintf(fid,   ['SeuilImageValues 0 4096' '\n' ]);
     3537 fprintf(fid,   ['ImageToUse '  term_a ' '  term_b '\n' ]); % VERIFIER ?
     3538 fprintf(fid,   ['ImageUsedBefore null null' '\n' ]);
     3539fclose(fid);
     3540       
    34933541                s=-1;
    34943542        display(['!' civ1_exe ' -f ' filename_cmx ' > ' namelog])
     
    35043552end
    35053553
    3506 %---------------------------------------------------------------
     3554%------------------------------------------------------------------------
    35073555% RUN CIV2   CIV2    CIV2   CIV2
    3508 %-----------------------------------------------------------
    35093556function RUN_CIV2(handles,filecell_2,filecell_3,filecell_nc1,filecell_nc2,num1,num2,num_a,num_b,nom_type_nc)
     3557%------------------------------------------------------------------------
    35103558%filecell_2: names of first image
    35113559%filecell_3: names of second images
     
    36523700                ['ImageUsedBefore ' filename_nc1]};
    36533701        textout=char(textcmx);
    3654         dlmwrite(filename_cmx,textout,'');    
     3702        dlmwrite(filename_cmx,textout,'');
    36553703        s=-1; 
    36563704        display(['!' civ2_exe ' -f ' filename_cmx ' > ' namelog])
     
    36683716% close(h)
    36693717
    3670          
    3671 %----------------------------------------
    3672 %PATCH
    3673 %---------------------------------------
     3718%------------------------------------------------------------------------
     3719% --- PATCH
    36743720function cmd_PATCH=RUN_PATCH(filename_nc,nx_patch,ny_patch,rho_patch,subdomain_patch,thresh_value,test_interp)
     3721%------------------------------------------------------------------------
    36753722global patch_exe patch_new_exe
    36763723        namelog=[filename_nc([1:end-3]) '_patch.log'];
     
    36823729                ' -max ' thresh_value ' -nopt ' subdomain_patch  '  > ' namelog ' 2>&1']; % redirect standard output to the log file
    36833730        end
    3684              
    3685 %----------------------------------------
    3686 %STEREO Interp
    3687 %---------------------------------------
     3731
     3732%------------------------------------------------------------------------
     3733% --- STEREO Interp
    36883734function cmd=RUN_STINTERP(stinterp_exe,filename_A_nc,filename_B_nc,filename_nc,nx_patch,ny_patch,rho_patch,subdomain_patch,thresh_value,xmlA,xmlB)
     3735%------------------------------------------------------------------------
    36893736namelog=[filename_nc([1:end-3]) '_stinterp.log'];
    36903737cmd=[stinterp_exe ' -f1 ' filename_A_nc  ' -f2 ' filename_B_nc ' -f  ' filename_nc ...
    36913738    ' -m ' nx_patch  ' -n ' ny_patch ' -ro ' rho_patch ' -nopt ' subdomain_patch ' -c1 ' xmlA ' -c2 ' xmlB '  -xy  x -Nfy 1024 > ' namelog ' 2>&1']; % redirect standard output to the log file
    3692  
    3693 %----------------------------------------------------
    3694 function first_j_Callback(hObject, eventdata, handles)
    3695 last_j_Callback(hObject, eventdata, handles)
    3696 
    3697 %---------------------------------------------------------
     3739
     3740%------------------------------------------------------------------------
    36983741% --- Executes on button press in CIV1.
    36993742function CIV1_Callback(hObject, eventdata, handles)
     3743%------------------------------------------------------------------------
    37003744val=get(handles.CIV1,'Value');
    37013745if isequal(val,1)
     
    37073751find_netcpair_civ1(hObject, eventdata, handles);
    37083752
    3709 %------------------------------------------------------
     3753%------------------------------------------------------------------------
    37103754% --- Executes on button press in FIX1.
    37113755function FIX1_Callback(hObject, eventdata, handles)
    3712 
     3756%------------------------------------------------------------------------
    37133757enable_fix1(handles,get(handles.FIX1,'Value'))
    37143758
    3715 
    3716 %----------------------------------------------------------------
     3759%------------------------------------------------------------------------
    37173760% --- Executes on button press in PATCH1.
    37183761function PATCH1_Callback(hObject, eventdata, handles)
    3719 
     3762%------------------------------------------------------------------------
    37203763if get(handles.PATCH1,'Value')==1
    3721 enable_patch1(handles)
    3722 else
    3723 desable_patch1(handles)
    3724 end
    3725 
    3726 %----------------------------------------------------------
     3764    enable_patch1(handles)
     3765else
     3766    desable_patch1(handles)
     3767end
     3768
     3769%------------------------------------------------------------------------
    37273770% --- Executes on button press in CIV2.
    37283771function CIV2_Callback(hObject, eventdata, handles)
     3772%------------------------------------------------------------------------
    37293773state=get(handles.CIV2,'Value');
    37303774enable_civ2(handles,state)
     
    37343778end
    37353779
    3736 %---------------------------------------------------
     3780%------------------------------------------------------------------------
    37373781% --- Executes on button press in FIX2.
    37383782function FIX2_Callback(hObject, eventdata, handles)
     3783%------------------------------------------------------------------------
    37393784if get(handles.FIX2,'Value')==1
    37403785    enable_fix2(handles)
     
    37463791end
    37473792
    3748 
    3749 %-------------------------------------------------------
     3793%------------------------------------------------------------------------
    37503794% --- Executes on button press in PATCH2.
    37513795function PATCH2_Callback(hObject, eventdata, handles)
    3752 %--------------------------------------------------------
     3796%------------------------------------------------------------------------
    37533797if get(handles.PATCH2,'Value')==1
    37543798    enable_patch2(handles)
     
    37603804end
    37613805
    3762 
    3763 
    3764 %-----------------------------------------------------------
     3806%------------------------------------------------------------------------
    37653807function first_i_Callback(hObject, eventdata, handles)
    3766 %------------------------------------------------------
    3767 last_i_Callback(hObject, eventdata, handles)
    3768 
    3769 %-----------------------------------------------------------
     3808%------------------------------------------------------------------------
     3809% last_i_Callback(hObject, eventdata, handles)
     3810first_i=str2num(get(handles.first_i,'String'));
     3811% last_i=str2num(get(handles.last_i,'String'));
     3812% ref_i=ceil((first_i+last_i)/2);
     3813set(handles.ref_i,'String', num2str(first_i))% reference index for pair dt = first index
     3814ref_i_Callback(hObject, eventdata, handles)%refresh dispaly of dt for pairs (in case of non constant dt)
     3815
     3816%------------------------------------------------------------------------
     3817function first_j_Callback(hObject, eventdata, handles)
     3818%------------------------------------------------------------------------
     3819first_j=str2num(get(handles.first_j,'String'));
     3820set(handles.ref_j,'String', num2str(first_j))% reference index for pair dt = first index
     3821ref_j_Callback(hObject, eventdata, handles)%refresh dispaly of dt for pairs (in case of non constant dt)
     3822
     3823%------------------------------------------------------------------------
    37703824% --- Executes on button press in calcul_search: determine the search range isx,isy
    3771 %--------------------------------------------------------
    37723825function calcul_search_Callback(hObject, eventdata, handles)
    3773 
     3826%------------------------------------------------------------------------
    37743827%determine pair numbers
    37753828list_pair=get(handles.list_pair_civ1,'String');%get the menu of image pairs
     
    38203873set(handles.isy,'String',num2str(isy));
    38213874
    3822 
    3823 %---------------------------------------------------------
    3824 % Executes on carriage return on the subdir civ1 edit window
    3825 %--------------------------------------------------------
     3875%------------------------------------------------------------------------
     3876% --- Executes on carriage return on the subdir civ1 edit window
    38263877function subdir_civ1_Callback(hObject, eventdata, handles)
     3878%------------------------------------------------------------------------
    38273879subdir=get(handles.subdir_civ1,'String');
    38283880set(handles.subdir_civ2,'String',subdir);
     
    38313883end
    38323884
    3833 %---------------------------------------------------------
    3834 % Executes on carriage return on the subdir civ1 edit window
    3835 %---------------------------------------------------------
     3885%------------------------------------------------------------------------
     3886% --- Executes on carriage return on the subdir civ1 edit window
    38363887function subdir_civ2_Callback(hObject, eventdata, handles)
     3888%------------------------------------------------------------------------
    38373889%update the list of available pairs from netcdf files in the new directory
    38383890if get(handles.CIV2,'Value')==0 & get(handles.CIV1,'Value')==0 & get(handles.FIX1,'Value')==0 & get(handles.PATCH1,'Value')==0
     
    38403892end
    38413893
    3842 %------------------------------------------------------
     3894%------------------------------------------------------------------------
    38433895% --- Executes on button press in get_mask_civ1.
    3844 %------------------------------------------------------
    38453896function get_mask_civ1_Callback(hObject, eventdata, handles)
     3897%------------------------------------------------------------------------
    38463898maskval=get(handles.get_mask_civ1,'Value');
    38473899if isequal(maskval,0)
     
    38573909            filebase_a=fullfile(common_path,get(handles.displ_filebase2,'String'));
    38583910            [nbslice_a, flag_mask_a]=get_mask(filebase_a,handles);
    3859             if isequal(flag_mask_a,0) | ~isequal(nbslice_a,nbslice_mask)
     3911            if isequal(flag_mask_a,0) || ~isequal(nbslice_a,nbslice_mask)
    38603912                mask_displ='no mask';
    38613913            end
     3914    end
     3915    if isequal(mask_displ,'no mask')
     3916        [FileName, PathName, filterindex] = uigetfile( ...
     3917               {'*.png', ' (*.png)';
     3918                '*.png',  '.png files '; ...
     3919                '*.*', 'All Files (*.*)'}, ...
     3920                'Pick a mask file *.png',filebase);
     3921        mask_displ=fullfile(PathName,FileName); 
     3922        if ~exist(mask_displ,'file')
     3923            mask_displ='no mask';
     3924        end
    38623925    end
    38633926    if isequal(mask_displ,'no mask')
     
    38763939end
    38773940
    3878 %--------------------------------------------------------------
     3941%------------------------------------------------------------------------
    38793942% --- Executes on button press in get_mask_fix1.
    38803943function get_mask_fix1_Callback(hObject, eventdata, handles)
     3944%------------------------------------------------------------------------
    38813945maskval=get(handles.get_mask_fix1,'Value');
    38823946if isequal(maskval,0)
     
    38963960end
    38973961if isequal(mask_displ,'no mask')
     3962    [FileName, PathName, filterindex] = uigetfile( ...
     3963           {'*.png', ' (*.png)';
     3964            '*.png',  '.png files '; ...
     3965            '*.*', 'All Files (*.*)'}, ...
     3966            'Pick a mask file *.png',filebase);
     3967    mask_displ=fullfile(PathName,FileName); 
     3968    if ~exist(mask_displ,'file')
     3969        mask_displ='no mask';
     3970    end
     3971end
     3972if isequal(mask_displ,'no mask')
    38983973    set(handles.get_mask_fix1,'Value',0)
    38993974    set(handles.get_mask_civ2,'Value',0)
     
    39073982set(handles.mask_fix2,'String',mask_displ)
    39083983end
    3909 %-----------------------------------------
     3984
     3985%------------------------------------------------------------------------
    39103986% --- Executes on button press in get_mask_civ2.
    39113987function get_mask_civ2_Callback(hObject, eventdata, handles)
     3988%------------------------------------------------------------------------
    39123989maskval=get(handles.get_mask_civ2,'Value');
    39133990if isequal(maskval,0)
     
    39274004end
    39284005if isequal(mask_displ,'no mask')
     4006    [FileName, PathName, filterindex] = uigetfile( ...
     4007           {'*.png', ' (*.png)';
     4008            '*.png',  '.png files '; ...
     4009            '*.*', 'All Files (*.*)'}, ...
     4010            'Pick a mask file *.png',filebase);
     4011    mask_displ=fullfile(PathName,FileName);
     4012    if ~exist(mask_displ,'file')
     4013        mask_displ='no mask';
     4014    end
     4015end
     4016if isequal(mask_displ,'no mask')
    39294017    set(handles.get_mask_civ2,'Value',0)
    39304018    set(handles.get_mask_fix2,'Value',0)
     
    39354023set(handles.mask_fix2,'String',mask_displ)
    39364024end
    3937 %-------------------------------------
     4025
     4026%------------------------------------------------------------------------
    39384027% --- Executes on button press in get_mask_fix2.
    39394028function get_mask_fix2_Callback(hObject, eventdata, handles)
     4029%------------------------------------------------------------------------
    39404030maskval=get(handles.get_mask_fix2,'Value');
    39414031if isequal(maskval,0)
    39424032    set(handles.mask_fix2,'String','')
    39434033else
    3944 mask_displ='no mask'; %default
    3945 filebase=get(handles.displ_filebase,'String');
    3946 [nbslice, flag_mask]=get_mask(filebase,handles);
    3947 if isequal(flag_mask,1)
    3948       mask_displ=[num2str(nbslice) 'mask'];
    3949 elseif get(handles.compare,'Value')>1 & ~isequal(mask_displ,'no mask')% look for the second mask series
    3950         filebase_a=get(handles.displ_filebase2,'String');
    3951         [nbslice_a, flag_mask_a]=get_mask(filebase_a,handles);
    3952         if isequal(flag_mask_a,0) | ~isequal(nbslice_a,nbslice)
     4034    mask_displ='no mask'; %default
     4035    filebase=get(handles.displ_filebase,'String');
     4036    [nbslice, flag_mask]=get_mask(filebase,handles);
     4037    if isequal(flag_mask,1)
     4038          mask_displ=[num2str(nbslice) 'mask'];
     4039    elseif get(handles.compare,'Value')>1 & ~isequal(mask_displ,'no mask')% look for the second mask series
     4040            filebase_a=get(handles.displ_filebase2,'String');
     4041            [nbslice_a, flag_mask_a]=get_mask(filebase_a,handles);
     4042            if isequal(flag_mask_a,0) | ~isequal(nbslice_a,nbslice)
     4043                mask_displ='no mask';
     4044            end
     4045    end
     4046    if isequal(mask_displ,'no mask')
     4047        [FileName, PathName, filterindex] = uigetfile( ...
     4048               {'*.png', ' (*.png)';
     4049                '*.png',  '.png files '; ...
     4050                '*.*', 'All Files (*.*)'}, ...
     4051                'Pick a mask file *.png',filebase);
     4052        mask_displ=fullfile(PathName,FileName); 
     4053        if ~exist(mask_displ,'file')
    39534054            mask_displ='no mask';
    39544055        end
    3955 end
    3956 if isequal(mask_displ,'no mask')
    3957     set(handles.get_mask_fix2,'Value',0)
    3958 end
    3959 set(handles.mask_fix2,'String',mask_displ)
    3960 end
    3961 
    3962 %---------------------------------------
     4056    end
     4057    if isequal(mask_displ,'no mask')
     4058        set(handles.get_mask_fix2,'Value',0)
     4059    end
     4060    set(handles.mask_fix2,'String',mask_displ)
     4061end
     4062
     4063%------------------------------------------------------------------------
     4064% --- function called to look for mask files
    39634065function [nbslice, flag_mask]=get_mask(filebase,handles)
     4066%------------------------------------------------------------------------
    39644067%detect mask files, images with appropriate file base
    39654068%[filebase '_' xx 'mask'], xx=nbslice
     
    39714074% subdir=get(handles.subdir_civ1,'String');
    39724075[Path,Name]=fileparts(filebase);
     4076if ~isdir(Path)
     4077    msgbox_uvmat('ERROR','no path for input files')
     4078    return
     4079end
    39734080currentdir=pwd;
    39744081cd(Path);%move in the dir of the root name filebase
    39754082maskfiles=dir([Name '_*mask_*.png']);%look for mask files
    39764083cd(currentdir);%come back to the current working directory
    3977 if isempty(maskfiles)
    3978     msgbox_uvmat('ERROR','no mask available, to create it use Tools/Make mask in the upper menu bar of uvmat')
    3979 else
     4084if ~isempty(maskfiles)
     4085%     msgbox_uvmat('ERROR','no mask available, to create it use Tools/Make mask in the upper menu bar of uvmat')
     4086% else
    39804087    flag_mask=1;
    39814088    maskname=maskfiles(1).name;% take the first mask file in the list
     
    39984105end   
    39994106
    4000 %---------------------------------------
     4107%------------------------------------------------------------------------
     4108% --- function called to look for grid files
    40014109function [nbslice, flag_mask]=get_grid(filebase,handles)
    4002 
     4110%------------------------------------------------------------------------
    40034111flag_mask=0;%default
    40044112nbslice=1;
     
    40274135          nbslice=1;
    40284136    end
    4029 end   
    4030 %------------------------------
    4031 
    4032 function grid_civ1_Callback(hObject, eventdata, handles)
    4033 % hObject    handle to grid_civ1 (see GCBO)
    4034 % eventdata  reserved - to be defined in a future version of MATLAB
    4035 % handles    structure with handles and user data (see GUIDATA)
    4036 
    4037 % Hints: get(hObject,'String') returns contents of grid_civ1 as text
    4038 %        str2double(get(hObject,'String')) returns contents of grid_civ1 as a double
    4039 
    4040 
    4041 %-----------------------------------------------------------
    4042 % transform numbers to letters
    4043 %--------------------------------------------
     4137end
     4138
     4139%------------------------------------------------------------------------
     4140% --- transform numbers to letters
    40444141function str=num2stra(num,nom_type);
     4142%------------------------------------------------------------------------
    40454143if isequal(nom_type,'png_old') | isequal(nom_type,'netc_old') |isequal(nom_type,'raw_SMD')
    40464144    str=char(96+num);
     
    40514149    str=num2str(num);
    40524150end
    4053 %---------------------------------------------------
     4151
     4152%------------------------------------------------------------------------
    40544153function mask_civ1_Callback(hObject, eventdata, handles)
     4154%------------------------------------------------------------------------
    40554155set(handles.mask_civ1,'UserData',[])
    40564156set(handles.mask_civ1,'String','')
    4057 %----------------------------------------------------
     4157
     4158%------------------------------------------------------------------------
    40584159function mask_civ2_Callback(hObject, eventdata, handles)
     4160%------------------------------------------------------------------------
    40594161set(handles.mask_civ2,'UserData',[])
    40604162set(handles.mask_civ2,'String','')
    4061 %----------------------------------------------------
     4163
     4164%------------------------------------------------------------------------
    40624165function mask_fix1_Callback(hObject, eventdata, handles)
     4166%------------------------------------------------------------------------
    40634167set(handles.mask_fix1,'UserData',[])
    40644168set(handles.mask_fix1,'String','')
    4065 %----------------------------------------------------
     4169
     4170%------------------------------------------------------------------------
    40664171function mask_fix2_Callback(hObject, eventdata, handles)
     4172%------------------------------------------------------------------------
    40674173set(handles.mask_fix2,'UserData',[])
    40684174set(handles.mask_fix2,'String','')
    40694175
    4070 %--------------------------------------------------------------------------
     4176%------------------------------------------------------------------------
    40714177% --- Executes on button press in list_subdir_civ1.
    40724178function list_subdir_civ1_Callback(hObject, eventdata, handles)
     4179%------------------------------------------------------------------------
    40734180list_subdir_civ1=get(handles.list_subdir_civ1,'String');
    40744181val=get(handles.list_subdir_civ1,'Value');
     
    40794186end
    40804187
    4081 
    4082 %--------------------------------------------------------------------------
     4188%------------------------------------------------------------------------
    40834189% --- Executes on button press in list_subdir_civ2.
    40844190function list_subdir_civ2_Callback(hObject, eventdata, handles)
     4191%------------------------------------------------------------------------
    40854192list_subdir_civ2=get(handles.list_subdir_civ2,'String');
    40864193val=get(handles.list_subdir_civ2,'Value');
     
    40914198end
    40924199
    4093 
    4094 %----------------------------------------------
    4095 function last_i_Callback(hObject, eventdata, handles)
    4096 first_i=str2num(get(handles.first_i,'String'));
    4097 last_i=str2num(get(handles.last_i,'String'));
    4098 ref_i=ceil((first_i+last_i)/2);
    4099 set(handles.ref_i,'String', num2str(ref_i))
    4100 ref_i_Callback(hObject, eventdata, handles)
    4101 
    4102 %-------------------------------------------------------
    4103 function last_j_Callback(hObject, eventdata, handles)
    4104 first_j=str2num(get(handles.first_j,'String'));
    4105 last_j=str2num(get(handles.last_j,'String'));
    4106 ref_j=ceil((first_j+last_j)/2);
    4107 set(handles.ref_j,'String', num2str(ref_j))
    4108 ref_j_Callback(hObject, eventdata, handles)
    4109 
    4110 
    4111 %-----------------------------------------------------------
     4200%------------------------------------------------------------------------
    41124201% --- Executes on button press in browse_gridciv1.
    41134202function browse_gridciv1_Callback(hObject, eventdata, handles)
    4114 %-----------------------------------------------------------
     4203%------------------------------------------------------------------------
    41154204value=get(handles.browse_gridciv1,'Value');
    41164205testgrid=0;
     
    41604249end
    41614250
    4162 %-----------------------------------------------------------
     4251%------------------------------------------------------------------------
    41634252% --- Executes on button press in browse_gridciv1.
    41644253function browse_gridciv2_Callback(hObject, eventdata, handles)
    4165 %-----------------------------------------------------------
     4254%------------------------------------------------------------------------
    41664255value=get(handles.browse_gridciv2,'Value');
    41674256if value
     
    42314320% set(handles.grid_patch2,'string',filegrid
    42324321
    4233 %-----------------------------------------------------------------
     4322%------------------------------------------------------------------------
    42344323% --- Executes on button press in get_gridpatch2.
    42354324function get_gridpatch2_Callback(hObject, eventdata, handles)
    4236 
    4237 
    4238 %----------------------------------------------------------
     4325%------------------------------------------------------------------------
     4326
     4327%------------------------------------------------------------------------
    42394328function enable_civ1(handles,state)
     4329%------------------------------------------------------------------------
    42404330if isequal(state,0)
    42414331    state='off';
     
    42934383set(handles.rho_title,'Visible',state)
    42944384
    4295 %----------------------------------------------------------
     4385%------------------------------------------------------------------------
    42964386function enable_fix1(handles,state)
     4387%------------------------------------------------------------------------
    42974388if isequal(state,0)
    42984389    state='off';
     
    43214412set(handles.field_ref1,'Visible',state)
    43224413
    4323 
    4324 %--------------------------------------------------------------
     4414%------------------------------------------------------------------------
    43254415function enable_patch1(handles)
     4416%------------------------------------------------------------------------
    43264417global patch_new_exe
    43274418set(handles.frame_patch1,'BackgroundColor',[1 1 0])
     
    43434434set(handles.grid_patch1,'Visible','on')
    43444435
    4345 %--------------------------------------------------------------
     4436%------------------------------------------------------------------------
    43464437function desable_patch1(handles)
     4438%------------------------------------------------------------------------
    43474439set(handles.frame_patch1,'BackgroundColor',[0.831 0.816 0.784])
    43484440set(handles.rho_patch1,'Visible','off')
     
    43604452set(handles.grid_patch1,'Visible','off')
    43614453
    4362 %----------------------------------------------------------
     4454%------------------------------------------------------------------------
    43634455function enable_civ2(handles,state)
     4456%------------------------------------------------------------------------
    43644457if isequal(state,0)
    43654458    state='off';
     
    44154508end
    44164509
    4417 
    4418 %----------------------------------------------------------
     4510%------------------------------------------------------------------------
    44194511function enable_fix2(handles)
     4512%------------------------------------------------------------------------
    44204513set(handles.frame_fix2,'BackgroundColor',[1 1 0])
    44214514set(handles.REMOVE2,'Visible','on')
     
    44374530set(handles.field_ref2,'Visible','on')
    44384531
    4439 %----------------------------------------------------------
     4532%------------------------------------------------------------------------
    44404533function desable_fix2(handles)
     4534%------------------------------------------------------------------------
    44414535set(handles.frame_fix2,'BackgroundColor',[0.831 0.816 0.784])
    44424536set(handles.REMOVE2,'Visible','off')
     
    44604554end
    44614555
    4462 %--------------------------------------------------------------
     4556%------------------------------------------------------------------------
    44634557function enable_patch2(handles)
     4558%------------------------------------------------------------------------
    44644559set(handles.frame_patch2,'BackgroundColor',[1 1 0])
    44654560%set(handles.rho_patch2,'Visible','on')
     
    44794574set(handles.subdir_civ2_text,'Visible','on')
    44804575
    4481 %--------------------------------------------------------------
     4576%------------------------------------------------------------------------
    44824577function desable_patch2(handles)
     4578%------------------------------------------------------------------------
    44834579set(handles.frame_patch2,'BackgroundColor',[0.831 0.816 0.784])
    44844580set(handles.rho_patch2,'Visible','off')
     
    45004596end
    45014597
    4502 %--------------------------------------------------------------
     4598%------------------------------------------------------------------------
    45034599function enable_pair1(handles,state)
     4600%------------------------------------------------------------------------
    45044601set(handles.subdir_civ1,'Visible',state)
    45054602set(handles.list_subdir_civ1,'Visible',state)
     
    45084605set(handles.list_pair_civ1,'Visible',state)
    45094606set(handles.PAIR_txt,'Visible',state)
    4510 set(handles.dt_display_txt,'Visible',state)
     4607%set(handles.dt_display_txt,'Visible',state)
    45114608set(handles.dt_unit,'Visible',state)
    45124609set(handles.PAIR_frame,'Visible',state)
    45134610
    4514 % --- Executes on button press in test_interp.
    4515 function test_interp_Callback(hObject, eventdata, handles)
    4516 % hObject    handle to test_interp (see GCBO)
    4517 % eventdata  reserved - to be defined in a future version of MATLAB
    4518 % handles    structure with handles and user data (see GUIDATA)
    4519 
    4520 % Hint: get(hObject,'Value') returns toggle state of test_interp
    4521 
    4522 
    4523 
    4524 
    4525 
    4526 
    4527 %------------------------------------------------
    4528 %Read the parameters for civ1 on the interface
    4529 %--------------------------------------------------
     4611%------------------------------------------------------------------------
     4612% --- Read the parameters for civ1 on the interface
    45304613function par=read_param_civ1(handles,file_ima)
    4531 
     4614%------------------------------------------------------------------------
    45324615ibx_val=str2num(get(handles.ibx,'String'));
    45334616par.ibx=num2str(ibx_val);
     
    45514634         par.isy='41'; %default
    45524635         set(handles.isy,'String','41');
    4553 end;
     4636end
    45544637if isempty(str2num(par.shiftx))
    45554638         par.shiftx='0';%default
    45564639         set(handles.shiftx,'String','0');
    4557 end;
     4640end
    45584641if isempty(str2num(par.shifty))
    45594642         par.shifty='0'; %default
    45604643         set(handles.shifty,'String','0');
    4561 end;
    4562      par.rho=get(handles.rho,'String');
    4563      par.dx=get(handles.dx_civ1,'String');
    4564      par.dy=get(handles.dy_civ1,'String');
    4565      if isequal(str2num(par.dx),[])
    4566          if isempty(get(handles.grid_civ1,'String'));
    4567              par.dx='0'; %just read by civ program, not used
    4568          else
    4569             par.dx='20';%default
    4570             set(handles.dx_civ1,'String','20');
    4571          end
     4644end
     4645 par.rho=get(handles.rho,'String');
     4646 par.dx=get(handles.dx_civ1,'String');
     4647 par.dy=get(handles.dy_civ1,'String');
     4648 if isequal(str2num(par.dx),[])
     4649     if isempty(get(handles.grid_civ1,'String'));
     4650         par.dx='0'; %just read by civ program, not used
     4651     else
     4652        par.dx='20';%default
     4653        set(handles.dx_civ1,'String','20');
    45724654     end
    4573      if isequal(str2num(par.dy),[])
    4574          if isempty(get(handles.grid_civ1,'String'));
    4575              par.dy='0';%just read by civ program, not used
    4576          else
    4577             par.dy='20';%default
    4578             set(handles.dy_civ1_title,'String','20');
    4579          end
     4655 end
     4656 if isequal(str2num(par.dy),[])
     4657     if isempty(get(handles.grid_civ1,'String'));
     4658         par.dy='0';%just read by civ program, not used
     4659     else
     4660        par.dy='20';%default
     4661        set(handles.dy_civ1_title,'String','20');
    45804662     end
    4581         par.pxcmx='1'; %velocities are expressed in pixel dispalcement
    4582          par.pxcmy='1';
     4663 end
     4664    par.pxcmx='1'; %velocities are expressed in pixel dispalcement
     4665     par.pxcmy='1';
    45834666%      end
    4584      A=imread(file_ima);%read the first image to get the size
    4585      sizim=size(A);
    4586      par.npx=num2str(sizim(2));
    4587      par.npy=num2str(sizim(1));
    4588      time=get(handles.displ_filebase,'UserData'); %get the set of times
    4589      par.gridname=get(handles.grid_civ1,'String');
    4590      par.gridflag='y';
    4591      if isequal(par.gridname,'')| isempty(par.gridname)
    4592          par.gridname='nogrid';
    4593          par.gridflag='n';
     4667 A=imread(file_ima);%read the first image to get the size
     4668 sizim=size(A);
     4669 par.npx=num2str(sizim(2));
     4670 par.npy=num2str(sizim(1));
     4671 time=get(handles.displ_filebase,'UserData'); %get the set of times
     4672 par.gridname=get(handles.grid_civ1,'String');
     4673 par.gridflag='y';
     4674 if isequal(par.gridname,'')| isempty(par.gridname)
     4675     par.gridname='nogrid';
     4676     par.gridflag='n';
     4677 end
     4678
     4679%------------------------------------------------------------------------
     4680function par=read_param_civ2(handles,file_ima)
     4681%------------------------------------------------------------------------
     4682par.ibx=get(handles.ibx_civ2,'String');
     4683par.iby=get(handles.iby_civ2,'String');
     4684par.rho=get(handles.rho_civ2,'String');
     4685par.decimal=int2str(get(handles.decimal,'Value'));
     4686par.deformation=int2str(get(handles.deformation,'Value'));
     4687par.dx=get(handles.dx_civ2,'String');
     4688par.dy=get(handles.dy_civ2,'String');
     4689if isequal(str2num(par.dx),[])
     4690     if isempty(get(handles.grid_civ2,'String'));
     4691         par.dx='0'; %just read by civ program, not used
     4692     else
     4693        par.dx='20';%default
     4694        set(handles.dx_civ2,'String','20');
    45944695     end
    4595      
    4596 %----------------------------------------------------------------
    4597 function par=read_param_civ2(handles,file_ima)
    4598     par.ibx=get(handles.ibx_civ2,'String');
    4599     par.iby=get(handles.iby_civ2,'String');
    4600     par.rho=get(handles.rho_civ2,'String');
    4601     par.decimal=int2str(get(handles.decimal,'Value'));
    4602     par.deformation=int2str(get(handles.deformation,'Value'));
    4603     par.dx=get(handles.dx_civ2,'String');
    4604     par.dy=get(handles.dy_civ2,'String');
    4605     if isequal(str2num(par.dx),[])
    4606          if isempty(get(handles.grid_civ2,'String'));
    4607              par.dx='0'; %just read by civ program, not used
    4608          else
    4609             par.dx='20';%default
    4610             set(handles.dx_civ2,'String','20');
    4611          end
     4696 end
     4697 if isequal(str2num(par.dy),[])
     4698     if isempty(get(handles.grid_civ2,'String'));
     4699         par.dy='0';%just read by civ program, not used
     4700     else
     4701        par.dy='20';%default
     4702        set(handles.dy_civ2,'String','20');
    46124703     end
    4613      if isequal(str2num(par.dy),[])
    4614          if isempty(get(handles.grid_civ2,'String'));
    4615              par.dy='0';%just read by civ program, not used
    4616          else
    4617             par.dy='20';%default
    4618             set(handles.dy_civ2,'String','20');
    4619          end
    4620      end
    4621      par.pxcmx='1';
    4622      par.pxcmy='1';
    4623     A=imread(file_ima);%read the first image to get the size
    4624     sizim=size(A);
    4625     par.npx=num2str(sizim(2));
    4626     par.npy=num2str(sizim(1));
    4627     time=get(handles.displ_filebase,'UserData'); %get the set of times
    4628     par.gridname=get(handles.grid_civ2,'String');
    4629     par.gridflag='y';
    4630     if isequal(par.gridname,'')| isempty(par.gridname)
    4631         par.gridname='nogrid';
    4632         par.gridflag='n';
    4633     end
    4634 
    4635 
    4636 %---------------------------------------------------------
    4637 %CIV1  CIV1  CIV1 CIV1
    4638 %----------------------------------------------------------
     4704 end
     4705 par.pxcmx='1';
     4706 par.pxcmy='1';
     4707A=imread(file_ima);%read the first image to get the size
     4708sizim=size(A);
     4709par.npx=num2str(sizim(2));
     4710par.npy=num2str(sizim(1));
     4711time=get(handles.displ_filebase,'UserData'); %get the set of times
     4712par.gridname=get(handles.grid_civ2,'String');
     4713par.gridflag='y';
     4714if isequal(par.gridname,'')| isempty(par.gridname)
     4715    par.gridname='nogrid';
     4716    par.gridflag='n';
     4717end
     4718
     4719%------------------------------------------------------------------------
     4720% --- CIV1  CIV1  CIV1 CIV1
    46394721function cmd_CIV1=BATCH_CIV1(filename,namelog,par,handles)
     4722%------------------------------------------------------------------------
    46404723%pixels per cm and matrix of the image times, read from the .civ file by uvmat
    46414724global civ1_exe Civ_exe sge%name of the executable for civ1 calculation
     
    46464729                par.Dt='1' ;%case of 'displacement' mode
    46474730            end         
    4648  
    4649     textcmx={'##############   CMX file';...
    4650     ['FirstImage ' par.filename_ima_a];...
    4651     ['LastImage  ' par.filename_ima_b];...
    4652     'XX' ;...
    4653     ['Mask ' par.maskflag] ;...
    4654     ['MaskName ' par.maskname];...
    4655     ['ImageSize ' par.npx ' ' par.npy];...   %VERIFIER CAS GENERAL ?
    4656     ['CorrelationBoxesSize ' par.ibx ' ' par.iby];...
    4657     ['SearchBoxeSize ' par.isx ' ' par.isy];...
    4658     ['RO ' par.rho];...
    4659     ['GridSpacing ' par.dx ' ' par.dy];...
    4660     'XX 1.0';...
    4661     ['Dt_TO ' par.Dt ' ' par.T0];...
    4662     ['PixCmXY ' par.pxcmx ' ' par.pxcmy];...
    4663     'XX 1';...
    4664     ['ShiftXY ' par.shiftx ' '  par.shifty];...
    4665     ['Grid ' par.gridflag];...
    4666     ['GridName ' par.gridname] ;...
    4667     'XX 85';...
    4668     'XX 1.0';...
    4669     'XX 1.0';...
    4670     'Hart 1';...
    4671     'DecimalShift 0';...
    4672     'Deformation 0';...
    4673     'CorrelationMin 0';...
    4674     'IntensityMin 0';...
    4675     'SeuilImage n';...
    4676     'SeuilImageValues 0 4096';...
    4677     ['ImageToUse ' par.term_a ' ' par.term_b];... % VERIFIER ?
    4678     'ImageUsedBefore null null'};
    4679 
    4680             textout=char(textcmx);
    4681     %         timeL1=clock;
    4682             dlmwrite([filename '.cmx'],textout,'');
    4683     %             timeL2=clock;
    4684     %     timciv1=etime(timeL2,timeL1)
    4685           if sge 
    4686           cmd_CIV1=[civ1_exe ' -f ' filename '.cmx' ]; % redirect standard output to the log file
    4687           else
    4688               cmd_CIV1=[civ1_exe ' -f ' filename_cmx ' > ' namelog ' 2>&1']; % redirect standard output to the log file
    4689           end
    4690     if(isunix)
    4691         [Rootbat,Filebat,extbat]=fileparts(namelog);
    4692         ncName=fullfile(Rootbat,[ Filebat '.nc']);
    4693             cmd_CIV1=char({cmd_CIV1 ; ['mv ' namelog  ' ' namelog '.civ1.log'];['chmod g+w ' ncName]});
    4694     else
    4695         cmd_CIV1=char({cmd_CIV1 ; ['copy /Y ' namelog ' ' namelog '.civ1.log']});
    4696     end
    4697 
    4698 %---------------------------------------------------------
    4699 %CIV1  Unified
    4700 %----------------------------------------------------------
     4731
     4732%     textcmx={'##############   CMX file';...
     4733%     ['FirstImage ' par.filename_ima_a];...
     4734%     ['LastImage  ' par.filename_ima_b];...
     4735%     'XX' ;...
     4736%     ['Mask ' par.maskflag] ;...
     4737%     ['MaskName ' par.maskname];...
     4738%     ['ImageSize ' par.npx ' ' par.npy];...   %VERIFIER CAS GENERAL ?
     4739%     ['CorrelationBoxesSize ' par.ibx ' ' par.iby];...
     4740%     ['SearchBoxeSize ' par.isx ' ' par.isy];...
     4741%     ['RO ' par.rho];...
     4742%     ['GridSpacing ' par.dx ' ' par.dy];...
     4743%     'XX 1.0';...
     4744%     ['Dt_TO ' par.Dt ' ' par.T0];...
     4745%     ['PixCmXY ' par.pxcmx ' ' par.pxcmy];...
     4746%     'XX 1';...
     4747%     ['ShiftXY ' par.shiftx ' '  par.shifty];...
     4748%     ['Grid ' par.gridflag];...
     4749%     ['GridName ' par.gridname] ;...
     4750%     'XX 85';...
     4751%     'XX 1.0';...
     4752%     'XX 1.0';...
     4753%     'Hart 1';...
     4754%     'DecimalShift 0';...
     4755%     'Deformation 0';...
     4756%     'CorrelationMin 0';...
     4757%     'IntensityMin 0';...
     4758%     'SeuilImage n';...
     4759%     'SeuilImageValues 0 4096';...
     4760%     ['ImageToUse ' par.term_a ' ' par.term_b];... % VERIFIER ?
     4761%     'ImageUsedBefore null null'};
     4762%
     4763%             textout=char(textcmx);
     4764
     4765   fid=fopen([filename '.cmx'],'w');
     4766fprintf(fid,['##############   CMX file' '\n' ]);
     4767 fprintf(fid,   ['FirstImage ' par.filename_ima_a '\n' ]);
     4768 fprintf(fid,   ['LastImage  ' par.filename_ima_b '\n' ]);
     4769  fprintf(fid,  ['XX' '\n' ]);
     4770  fprintf(fid,  ['Mask ' par.maskflag '\n' ]);
     4771  fprintf(fid,  ['MaskName ' par.maskname '\n' ]);
     4772 fprintf(fid,   ['ImageSize ' par.npx ' ' par.npy '\n' ]);   %VERIFIER CAS GENERAL ?
     4773 fprintf(fid,   ['CorrelationBoxesSize ' par.ibx ' ' par.iby '\n' ]);
     4774 fprintf(fid,   ['SearchBoxeSize ' par.isx ' ' par.isy '\n' ]);
     4775 fprintf(fid,   ['RO ' par.rho '\n' ]);
     4776 fprintf(fid,   ['GridSpacing ' par.dx ' ' par.dy '\n' ]);
     4777 fprintf(fid,   ['XX 1.0' '\n' ]);
     4778 fprintf(fid,   ['Dt_TO ' par.Dt ' ' par.T0 '\n' ]);
     4779  fprintf(fid,  ['PixCmXY ' par.pxcmx ' ' par.pxcmy '\n' ]);
     4780  fprintf(fid,  ['XX 1' '\n' ]);
     4781 fprintf(fid,   ['ShiftXY ' par.shiftx ' '  par.shifty '\n' ]);
     4782  fprintf(fid,  ['Grid ' par.gridflag '\n' ]);
     4783 fprintf(fid,   ['GridName ' par.gridname '\n' ]);
     4784 fprintf(fid,   ['XX 85' '\n' ]);
     4785 fprintf(fid,   ['XX 1.0' '\n' ]);
     4786 fprintf(fid,   ['XX 1.0' '\n' ]);
     4787 fprintf(fid,   ['Hart 1' '\n' ]);
     4788 fprintf(fid,  [ 'DecimalShift 0' '\n' ]);
     4789 fprintf(fid,   ['Deformation 0' '\n' ]);
     4790  fprintf(fid,  ['CorrelationMin 0' '\n' ]);
     4791 fprintf(fid,   ['IntensityMin 0' '\n' ]);
     4792  fprintf(fid,  ['SeuilImage n' '\n' ]);
     4793 fprintf(fid,   ['SeuilImageValues 0 4096' '\n' ]);
     4794 fprintf(fid,   ['ImageToUse ' par.term_a ' ' par.term_b '\n' ]); % VERIFIER ?
     4795 fprintf(fid,   ['ImageUsedBefore null null' '\n' ]);
     4796fclose(fid);
     4797 
     4798if sge 
     4799    cmd_CIV1=[civ1_exe ' -f ' filename '.cmx' ]; % redirect standard output to the log file
     4800else
     4801    cmd_CIV1=[civ1_exe ' -f ' filename_cmx ' > ' namelog ' 2>&1']; % redirect standard output to the log file
     4802end
     4803if(isunix)
     4804    [Rootbat,Filebat,extbat]=fileparts(namelog);
     4805    ncName=fullfile(Rootbat,[ Filebat '.nc']);
     4806    cmd_CIV1=[cmd_CIV1 '\n' 'mv ' namelog  ' ' namelog '.civ1.log' '\n' 'chmod g+w ' ncName];
     4807else
     4808    cmd_CIV1=[cmd_CIV1 '\n' 'copy /Y ' namelog ' ' namelog '.civ1.log'];
     4809end
     4810
     4811%------------------------------------------------------------------------
     4812% --- CIV1  Unified
    47014813function xml_civ1_parameters=BATCH_CIV1_Unified(filename,namelog,par)
     4814%------------------------------------------------------------------------
    47024815%pixels per cm and matrix of the image times, read from the .civ file by uvmat
    47034816global civ1_exe Civ_exe%name of the executable for civ1 calculation
     
    47344847 
    47354848    xml_civ1_parameters=civ1;
    4736    
    4737 %---------------------------------------------------------
    4738 %CIV2  Unified
    4739 %----------------------------------------------------------
     4849
     4850%------------------------------------------------------------------------
     4851% --- CIV2  Unified
    47404852function civ2=BATCH_CIV2_Unified(filename,namelog,par)
     4853%------------------------------------------------------------------------
    47414854%pixels per cm and matrix of the image times, read from the .civ file by uvmat
    47424855global civ2_exe Civ_exe%name of the executable for civ1 calculation
     
    47874900civ2.convectFlow='n';
    47884901
    4789 %---------------------------------------------------------
    4790 %CIV2  CIV2  CIV2 CIV2
    4791 %----------------------------------------------------------
     4902%------------------------------------------------------------------------
     4903% --- CIV2  CIV2  CIV2 CIV2
    47924904function cmd_CIV2=BATCH_CIV2(filename_cmx,namelog,par)
     4905%------------------------------------------------------------------------
    47934906%pixels per cm and matrix of the image times, read from the .civ file by uvmat
    47944907global civ2_exe sge%name of the executable for civ1 calculation
     
    47964909                par.Dt='1' ;%case of 'displacement' mode
    47974910  end
    4798 textcmx={'##############   CMX file';...
    4799 ['FirstImage ' par.filename_ima_a];...
    4800 ['LastImage  ' par.filename_ima_b];...
    4801 'XX' ;...
    4802 ['Mask ' par.maskflag];...
    4803 ['MaskName ' par.maskname];...
    4804 ['ImageSize ' par.npx ' ' par.npy];...   
    4805 ['CorrelationBoxesSize ' par.ibx ' ' par.iby];...
    4806 ['SearchBoxeSize ' par.ibx ' ' par.iby];...
    4807 ['RO ' par.rho];...
    4808 ['GridSpacing ' par.dx ' ' par.dy];...
    4809 'XX 1.0';...
    4810 ['Dt_TO ' par.Dt ' ' par.T0];...
    4811 ['PixCmXY ' par.pxcmx ' ' par.pxcmy];...
    4812 'XX 1';...
    4813 ['ShiftXY 0 0'];...
    4814 ['Grid ' par.gridflag];...
    4815 ['GridName ' par.gridname];...
    4816 'XX 85';...
    4817 'XX 1.0';...
    4818 'XX 1.0';...
    4819 'Hart 1';...
    4820 ['DecimalShift ' par.decimal];...
    4821 ['Deformation ' par.deformation];...
    4822 'CorrelationMin 0';...
    4823 'IntensityMin 0';...
    4824 'SeuilImage n';...
    4825 'SeuilImageValues 0 4096';...
    4826 ['ImageToUse ' par.term_a ' ' par.term_b];... % VERIFIER ?
    4827 ['ImageUsedBefore ' par.filename_nc1]};
    4828         textout=char(textcmx);
    4829         dlmwrite([filename_cmx '2'] ,textout,'');
    4830         if sge
    4831         cmd_CIV2=[civ2_exe ' -f ' filename_cmx ]; % redirect standard output to the log file
    4832         else
    4833           cmd_CIV2=[civ2_exe ' -f ' filename_cmx ' > ' namelog ' 2>&1']; % redirect standard output to the log file
    4834       end
    4835 
    4836 
     4911textcmx=['##############   CMX file'  '\n'...
     4912['FirstImage ' par.filename_ima_a]  '\n'...
     4913['LastImage  ' par.filename_ima_b]  '\n'...
     4914'XX'   '\n'...
     4915['Mask ' par.maskflag]  '\n'...
     4916['MaskName ' par.maskname]  '\n'...
     4917['ImageSize ' par.npx ' ' par.npy]  '\n'...   
     4918['CorrelationBoxesSize ' par.ibx ' ' par.iby]  '\n'...
     4919['SearchBoxeSize ' par.ibx ' ' par.iby]  '\n'...
     4920['RO ' par.rho]  '\n'...
     4921['GridSpacing ' par.dx ' ' par.dy]  '\n'...
     4922'XX 1.0'  '\n'...
     4923['Dt_TO ' par.Dt ' ' par.T0]  '\n'...
     4924['PixCmXY ' par.pxcmx ' ' par.pxcmy]  '\n'...
     4925'XX 1'  '\n'...
     4926['ShiftXY 0 0']  '\n'...
     4927['Grid ' par.gridflag]  '\n'...
     4928['GridName ' par.gridname]  '\n'...
     4929'XX 85'  '\n'...
     4930'XX 1.0'  '\n'...
     4931'XX 1.0'  '\n'...
     4932'Hart 1'  '\n'...
     4933['DecimalShift ' par.decimal]  '\n'...
     4934['Deformation ' par.deformation]  '\n'...
     4935'CorrelationMin 0'  '\n'...
     4936'IntensityMin 0'  '\n'...
     4937'SeuilImage n'  '\n'...
     4938'SeuilImageValues 0 4096'  '\n'...
     4939['ImageToUse ' par.term_a ' ' par.term_b]  '\n'... % VERIFIER ?
     4940['ImageUsedBefore ' par.filename_nc1]];
     4941textout=char(textcmx);
     4942fid=fopen([filename_cmx '2'],'w');
     4943fprintf(fid,textout);
     4944fclose(fid)
     4945if sge
     4946    cmd_CIV2=[civ2_exe ' -f ' filename_cmx ]; % redirect standard output to the log file
     4947else
     4948    cmd_CIV2=[civ2_exe ' -f ' filename_cmx ' > ' namelog ' 2>&1']; % redirect standard output to the log file
     4949end
     4950
     4951%------------------------------------------------------------------------
    48374952% --- Executes on button press in HELP.
    48384953function HELP_Callback(hObject, eventdata, handles)
     4954%------------------------------------------------------------------------
    48394955path_to_uvmat=which ('uvmat');% check the path of uvmat
    48404956pathelp=fileparts(path_to_uvmat);
     
    48454961end
    48464962
    4847 
    4848 %----------------------------------------------------------
     4963%------------------------------------------------------------------------
    48494964%--read images and convert them to the uint16 format used for PIV
    48504965function A=read_image(filename,nom_type,npx,npy,num);
     4966%------------------------------------------------------------------------
    48514967%npx, npy are the dimensions needed for the raw SMD images
    48524968%num is the view number needed for an avi movie
     
    48704986    A=uint16(A);
    48714987end
    4872        
    4873 %----------------------------------------------------------------
    4874 %Executes on carriage return on the time interval dt
    4875 %----------------------------------------------------------------
    4876 function dt_Callback(hObject, eventdata, handles)
    4877 %determine the set of times and possible intervals for CIV
    4878 %                 answer=inputdlg('time interval between images?');
    4879                 dt=(1/1000)*str2num(get(handles.dt,'String'));
    4880                 nbfield=str2num(get(handles.nb_field,'String')); %last image number selected in the processing series
    4881                 time=(dt*[0:nbfield-1])';
    4882 %                 set(handles.incr_i,'UserData',dt);%store the time interval between successive images
    4883                 set(handles.displ_filebase,'UserData',time); %store the set of times
    4884                 for index=1:min(nbfield-1,200)
    4885                     displ_num(1,index)=1;
    4886                     displ_num(2,index)=1;
    4887                     displ_num(3,index)=-floor(index/2);
    4888                     displ_num(4,index)=ceil(index/2);
    4889                 end
    4890 set(handles.list_pair_civ1,'Value',1);
    4891 set(handles.list_pair_civ1,'UserData',displ_num);
    4892 set(handles.list_pair_civ2,'Value',1);
    4893 %update the list of time intervals
    4894 find_netcpair_civ1(hObject, eventdata, handles)
    4895 find_netcpair_civ2(hObject, eventdata, handles)
    4896 
    4897 %-------------------------------------------------------
     4988
     4989% %----------------------------------------------------------------
     4990% %Executes on carriage return on the time interval dt
     4991% %----------------------------------------------------------------
     4992% function dt_Callback(hObject, eventdata, handles)
     4993% %determine the set of times and possible intervals for CIV
     4994% %                 answer=inputdlg('time interval between images?');
     4995%                 dt=(1/1000)*str2num(get(handles.dt,'String'));
     4996%                 nbfield=str2num(get(handles.nb_field,'String')); %last image number selected in the processing series
     4997%                 time=(dt*[0:nbfield-1])';
     4998% %                 set(handles.incr_i,'UserData',dt);%store the time interval between successive images
     4999%                 set(handles.displ_filebase,'UserData',time); %store the set of times
     5000%                 for index=1:min(nbfield-1,200)
     5001%                     displ_num(1,index)=1;
     5002%                     displ_num(2,index)=1;
     5003%                     displ_num(3,index)=-floor(index/2);
     5004%                     displ_num(4,index)=ceil(index/2);
     5005%                 end
     5006% set(handles.list_pair_civ1,'Value',1);
     5007% set(handles.list_pair_civ1,'UserData',displ_num);
     5008% set(handles.list_pair_civ2,'Value',1);
     5009% %update the list of time intervals
     5010% find_netcpair_civ1(hObject, eventdata, handles)
     5011% find_netcpair_civ2(hObject, eventdata, handles)
     5012
     5013%------------------------------------------------------------------------
    48985014function ref_i_Callback(hObject, eventdata, handles)
     5015%------------------------------------------------------------------------
    48995016mode_list=get(handles.mode,'String');
    49005017mode_value=get(handles.mode,'Value');
    49015018mode=mode_list{mode_value};
    4902 if isequal(get(handles.CIV1,'Value'),0)| isequal(mode,'series(Di)')
     5019%if isequal(get(handles.CIV1,'Value'),0)|| isequal(mode,'series(Di)')
    49035020    find_netcpair_civ1(hObject, eventdata, handles);% update the menu of pairs depending on the available netcdf files
    4904 end
    4905 if isequal(mode,'series(Di)') | ...% we do patch2 only
     5021%end
     5022if isequal(mode,'series(Di)') || ...% we do patch2 only
    49065023   (get(handles.CIV2,'Value')==0 & get(handles.CIV1,'Value')==0 & get(handles.FIX1,'Value')==0 & get(handles.PATCH1,'Value')==0)
    49075024    find_netcpair_civ2(hObject, eventdata, handles);
    49085025end
    49095026
    4910 %----------------------------------------------------
     5027%------------------------------------------------------------------------
    49115028function ref_j_Callback(hObject, eventdata, handles)
     5029%------------------------------------------------------------------------
    49125030mode_list=get(handles.mode,'String');
    49135031mode_value=get(handles.mode,'Value');
     
    49205038    find_netcpair_civ2(hObject, eventdata, handles);
    49215039end
    4922 %----------------------------------------------------
     5040
     5041%------------------------------------------------------------------------
    49235042% --- Executes on button press in compare.
    49245043function compare_Callback(hObject, eventdata, handles)
     5044%------------------------------------------------------------------------
    49255045test=get(handles.compare,'Value');
    49265046if test==2 || test==3   
     
    49885108mode_Callback(hObject, eventdata, handles)
    49895109
    4990 %-----------------------------------------------------------
     5110%------------------------------------------------------------------------
    49915111% --- Executes on button press in get_ref_fix1.
    49925112function get_ref_fix1_Callback(hObject, eventdata, handles)
     5113%------------------------------------------------------------------------
    49935114filebase=get(handles.displ_filebase,'String');
    49945115[FileName, PathName, filterindex] = uigetfile( ...
     
    50015122sizf=size(fileinput);
    50025123if (~ischar(fileinput)|~isequal(sizf(1),1)),return;end %stop if fileinput not a character string
    5003 %[filebasesub,field_count,str2,str_a,str_b,ref.ext,ref.nom_type,ref.subdir]=name2display(fileinput);
    50045124[Path,File,field_count,str2,str_a,str_b,ref.ext,ref.nom_type,ref.subdir]=name2display(fileinput);
    5005 %filebase=fullfile(RootPath,RootFile);
    5006 % [Pth,FileN]=fileparts(filebasesub);
    5007 % Pth=fileparts(Pth);
    50085125ref.filebase=fullfile(Path,File);
    50095126ref.num_a=stra2num(str_a);
     
    50165133    return
    50175134end
    5018 % [path,name]=fileparts(ref.filebase);
    50195135set(handles.ref_fix1,'String',[fullfile(ref.subdir,File) '....nc']);
    50205136set(handles.ref_fix1,'UserData',ref)
     
    50305146    menu_field{4}='filter2';
    50315147end
    5032 % [cte_detect,vdt,cte_read]=read_netcdf(fileinput,{'patch','civ2','patch2'});
    5033 % if isequal(cte_detect(1),1) & isequal(cte_read(1),1)
    5034 %          menu_field{2}='filter1';
    5035 % end
    5036 % if isequal(cte_detect(2),1) & isequal(cte_read(2),1)
    5037 %          menu_field{3}='civ2';
    5038 % end
    5039 % if isequal(cte_detect(3),1) & isequal(cte_read(3),1)
    5040 %          menu_field{4}='filter2';
    5041 % end
    50425148set(handles.field_ref1,'String',menu_field);
    50435149set(handles.field_ref1,'Value',length(menu_field));
     
    50455151set(handles.thresh_vel,'String','1');%default threshold
    50465152set(handles.ref_fix1,'Enable','on')
    5047  
    5048 %---------------------------------------------------------------
     5153
     5154%------------------------------------------------------------------------
    50495155% --- Executes on button press in get_ref_fix2.
    50505156function get_ref_fix2_Callback(hObject, eventdata, handles)
     5157%------------------------------------------------------------------------
    50515158if isequal(get(handles.get_ref_fix2,'Value'),1)
    50525159    filebase=get(handles.displ_filebase,'String');
     
    50595166    sizf=size(fileinput);
    50605167    if (~ischar(fileinput)|~isequal(sizf(1),1)),return;end %stop if fileinput not a character string
    5061     %[filebasesub,field_count,str2,str_a,str_b,ref.ext,ref.nom_type,ref.subdir]=name2display(fileinput);
    50625168    [Path,File,field_count,str2,str_a,str_b,ref.ext,ref.nom_type,ref.subdir]=name2display(fileinput);
    5063 %     [Pth,FileN]=fileparts(filebasesub);
    5064 %     Pth=fileparts(Pth);
    50655169    ref.filebase=fullfile(Path,File);
    50665170    ref.num_a=stra2num(str_a);
     
    50735177        return
    50745178    end
    5075 %     [path,name]=fileparts(ref.filebase);
    50765179    set(handles.ref_fix2,'String',[fullfile(ref.subdir,File) '....nc']);
    50775180    set(handles.ref_fix2,'UserData',ref)   
    50785181    menu_field{1}='civ1';
    5079 %     [cte_detect,vdt,cte_read]=read_netcdf(fileinput,{'patch','civ2','patch2'});
    50805182    Data=nc2struct(fileinput,[]);
    50815183    if isfield(Data,'patch') & isequal(Data.patch,1)
     
    50885190        menu_field{4}='filter2';
    50895191    end
    5090 
    5091 %     if isequal(cte_detect(1),1) & isequal(cte_read(1),1)
    5092 %              menu_field{2}='filter1';
    5093 %     end
    5094 %     if isequal(cte_detect(2),1) & isequal(cte_read(2),1)
    5095 %              menu_field{3}='civ2';
    5096 %     end
    5097 %     if isequal(cte_detect(3),1) & isequal(cte_read(3),1)
    5098 %              menu_field{4}='filter2';
    5099 %     end
    51005192    set(handles.field_ref2,'String',menu_field);
    51015193    set(handles.field_ref2,'Value',length(menu_field));
     
    51095201    set(handles.field_ref2,'Visible','off')
    51105202end
    5111 %-------------------------------------------------------
    5112 
     5203
     5204%------------------------------------------------------------------------
    51135205function ref_fix1_Callback(hObject, eventdata, handles)
    5114     set(handles.inf_sup1,'Value',1);
    5115     set(handles.field_ref1,'Value',1)
    5116     set(handles.field_ref1,'String',{' '})
    5117     set(handles.ref_fix1,'UserData',[]);
    5118     set(handles.ref_fix1,'String','');
    5119     set(handles.thresh_vel1,'String','0');
     5206%------------------------------------------------------------------------
     5207set(handles.inf_sup1,'Value',1);
     5208set(handles.field_ref1,'Value',1)
     5209set(handles.field_ref1,'String',{' '})
     5210set(handles.ref_fix1,'UserData',[]);
     5211set(handles.ref_fix1,'String','');
     5212set(handles.thresh_vel1,'String','0');
    51205213 
    5121 
    5122 %------------------------------------------------------
    5123 
     5214%------------------------------------------------------------------------
    51245215function ref_fix2_Callback(hObject, eventdata, handles)
    5125     set(handles.inf_sup2,'Value',1);
    5126     set(handles.field_ref2,'Value',1)
    5127     set(handles.field_ref2,'String',{' '})
    5128     set(handles.ref_fix2,'UserData',[]);
    5129     set(handles.ref_fix2,'String','');
    5130     set(handles.thresh_vel2,'String','0');
    5131 
    5132 %--------------------------------------------------------
    5133 % --- Executes on selection change in inf_sup1.
    5134 function inf_sup1_Callback(hObject, eventdata, handles)
    5135 
    5136 %--------------------------------------------------------------------------
    5137 
    5138 
    5139 % --- Executes on selection change in field_ref.
    5140 function field_ref_Callback(hObject, eventdata, handles)
    5141 
    5142 %-------------------------------------------------------------------------
    5143 
    5144 % --- Executes on selection change in field_ref2.
    5145 function field_ref2_Callback(hObject, eventdata, handles)
    5146 
    5147 % -----------------------------------------------------------
     5216%------------------------------------------------------------------------
     5217set(handles.inf_sup2,'Value',1);
     5218set(handles.field_ref2,'Value',1)
     5219set(handles.field_ref2,'String',{' '})
     5220set(handles.ref_fix2,'UserData',[]);
     5221set(handles.ref_fix2,'String','');
     5222set(handles.thresh_vel2,'String','0');
     5223
     5224%------------------------------------------------------------------------
    51485225% transform letters to numbers
    5149 %--------------------------------------------
    51505226function numres=stra2num(str)
     5227%------------------------------------------------------------------------
    51515228numres=double(str)-96;
    51525229if double(str) >= 48 & double(str) <= 57 % = 1 for numbers
     
    51545231end
    51555232
    5156 
     5233%------------------------------------------------------------------------
    51575234% --- Executes on button press in test_stereo1.
    51585235function test_stereo1_Callback(hObject, eventdata, handles)
     5236%------------------------------------------------------------------------
    51595237if isequal(get(handles.test_stereo1,'Value'),0)
    51605238    set(handles.subdomain_patch1,'Visible','on')
     
    51655243end
    51665244
     5245%------------------------------------------------------------------------
    51675246% --- Executes on button press in test_stereo2.
    51685247function test_stereo2_Callback(hObject, eventdata, handles)
     5248%------------------------------------------------------------------------
    51695249if isequal(get(handles.test_stereo2,'Value'),0)
    51705250    set(handles.subdomain_patch2,'Visible','on')
     
    51755255end
    51765256
     5257%------------------------------------------------------------------------
    51775258% --- Executes on button press in ImaThreshold.
    51785259function ImaThreshold_Callback(hObject, eventdata, handles)
     5260%------------------------------------------------------------------------
    51795261if isequal(get(handles.ImaThreshold,'Value'),1)
    51805262    set(handles.MinIma,'Visible','on')
     
    51855267end
    51865268
    5187 
     5269%------------------------------------------------------------------------
    51885270% --- Executes on button press in ImaThreshold2.
    51895271function ImaThreshold2_Callback(hObject, eventdata, handles)
     5272%------------------------------------------------------------------------
    51905273if isequal(get(handles.ImaThreshold2,'Value'),1)
    51915274    set(handles.MinIma2,'Visible','on')
     
    51965279end
    51975280
    5198 
    5199 % --- Executes on button press in Experimental.
    5200 function Experimental_Callback(hObject, eventdata, handles)
    5201 
    5202 
    5203 
    5204 function ext_ima_1_Callback(hObject, eventdata, handles)
    5205 % hObject    handle to ext_ima_1 (see GCBO)
    5206 % eventdata  reserved - to be defined in a future version of MATLAB
    5207 % handles    structure with handles and user data (see GUIDATA)
    5208 
    5209 % Hints: get(hObject,'String') returns contents of ext_ima_1 as text
    5210 %        str2double(get(hObject,'String')) returns contents of ext_ima_1 as a double
    5211 
    5212 
    5213 % --- Executes during object creation, after setting all properties.
    5214 function ext_ima_1_CreateFcn(hObject, eventdata, handles)
    5215 % hObject    handle to ext_ima_1 (see GCBO)
    5216 % eventdata  reserved - to be defined in a future version of MATLAB
    5217 % handles    empty - handles not created until after all CreateFcns called
    5218 
    5219 % Hint: edit controls usually have a white background on Windows.
    5220 %       See ISPC and COMPUTER.
    5221 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    5222     set(hObject,'BackgroundColor','white');
    5223 end
    5224 
    5225 
    5226 
    5227 function ext_ima_Callback(hObject, eventdata, handles)
    5228 % hObject    handle to ext_ima (see GCBO)
    5229 % eventdata  reserved - to be defined in a future version of MATLAB
    5230 % handles    structure with handles and user data (see GUIDATA)
    5231 
    5232 % Hints: get(hObject,'String') returns contents of ext_ima as text
    5233 %        str2double(get(hObject,'String')) returns contents of ext_ima as a double
    5234 
    5235 
    5236 % --- Executes during object creation, after setting all properties.
    5237 function ext_ima_CreateFcn(hObject, eventdata, handles)
    5238 % hObject    handle to ext_ima (see GCBO)
    5239 % eventdata  reserved - to be defined in a future version of MATLAB
    5240 % handles    empty - handles not created until after all CreateFcns called
    5241 
    5242 % Hint: edit controls usually have a white background on Windows.
    5243 %       See ISPC and COMPUTER.
    5244 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    5245     set(hObject,'BackgroundColor','white');
    5246 end
    5247 
    5248 
  • trunk/src/dataview.m

    r2 r12  
    1 %TEST 'dataview': function for scanning directories in a campaign (TEST)
     1%'dataview': function for scanning directories in a campaign
    22%------------------------------------------------------------------------
    33% function varargout = series(varargin)
     
    2222function varargout = dataview(varargin)
    2323
    24 % Last Modified by GUIDE v2.5 28-Apr-2009 00:12:36
     24% Last Modified by GUIDE v2.5 13-Jan-2010 07:28:19
    2525
    2626% Begin initialization code - DO NOT EDIT
     
    3232                   'gui_LayoutFcn',  [] , ...
    3333                   'gui_Callback',   []);
    34 if nargin & isstr(varargin{1})
     34if nargin & ischar(varargin{1})
    3535    gui_State.gui_Callback = str2func(varargin{1});
    3636end
     
    4545
    4646% --- Executes just before dataview is made visible.
    47 function dataview_OpeningFcn(hObject, eventdata, handles, varargin)
     47function dataview_OpeningFcn(hObject, eventdata, handles, RootDir, SubCampaignTst,GeometryCalib)
    4848
    4949% Choose default command line output for dataview
    50 handles.output = hObject;
     50handles.output = 'Cancel';
    5151
    5252% Update handles structure
    5353guidata(hObject, handles);
    54 
    55 %----------------------------------------------------------------
     54testCancel=1;
     55testinputstring=0;
     56icontype='quest';%default question icon (text input asked)
     57
     58% Determine the position of the dialog - centered on the screen
     59FigPos=get(0,'DefaultFigurePosition');
     60OldUnits = get(hObject, 'Units');
     61set(hObject, 'Units', 'pixels');
     62OldPos = get(hObject,'Position');
     63FigWidth = OldPos(3);
     64FigHeight = OldPos(4);
     65ScreenUnits=get(0,'Units');
     66set(0,'Units','pixels');
     67ScreenSize=get(0,'ScreenSize');
     68set(0,'Units',ScreenUnits);
     69
     70FigPos(1)=1/2*(ScreenSize(3)-FigWidth);
     71FigPos(2)=2/3*(ScreenSize(4)-FigHeight);
     72FigPos(3:4)=[FigWidth FigHeight];
     73set(hObject, 'Position', FigPos);
     74set(hObject, 'Units', OldUnits);
     75
     76% % Show a question icon from dialogicons.mat - variables questIconData and questIconMap
     77% load dialogicons.mat
     78% eval(['IconData=' icontype 'IconData;'])
     79% eval(['IconCMap=' icontype 'IconMap;'])
     80% questIconMap(256,:) = get(handles.figure1, 'Color');
     81% Img=image(IconData, 'Parent', handles.axes1);
     82% set(handles.figure1, 'Colormap', IconCMap);
     83% set(handles.axes1, ...
     84%     'Visible', 'off', ...
     85%     'YDir'   , 'reverse'       , ...
     86%     'XLim'   , get(Img,'XData'), ...
     87%     'YLim'   , get(Img,'YData')  ...
     88%     );
     89if exist('GeometryCalib','var')
     90    DataviewData.GeometryCalib=GeometryCalib;
     91    set(hObject,'UserData',DataviewData)
     92end
     93if exist('SubCampaignTst','var') && isequal(SubCampaignTst,'y')
     94   set(handles.SubCampaignTest,'Value',1);
     95end
     96if exist('RootDir','var')
     97   set(handles.RootDirectory,'String',RootDir);
     98   set(handles.clean_civ_cmx,'Visible','off')
     99   set(handles.edit_xml,'Visible','off')
     100   set(handles.HELP,'Visible','off')
     101   set(handles.OK,'Visible','on')
     102   set(handles.Cancel,'Visible','on')
     103   set(handles.figure,'WindowStyle','modal')% Make% Make the GUI modal
     104   RootDirectory_Callback(hObject, eventdata, handles)
     105   % UIWAIT makes translate_points wait for user response (see UIRESUME)
     106   uiwait(handles.figure);
     107end
     108
     109
     110
     111%------------------------------------------------------------------------
    56112% --- Outputs from this function are returned to the command line.
    57113function varargout = dataview_OutputFcn(hObject, eventdata, handles)
    58 
     114%------------------------------------------------------------------------
    59115% Get default command line output from handles structure
    60116varargout{1} = handles.output;
    61 
    62 
    63 
    64 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    65 %------------------------------------------------------
     117delete(handles.figure)
     118
     119%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
     120%------------------------------------------------------------------------
    66121% --- Executes on button press in browser.
    67122function browser_Callback(hObject, eventdata, handles)
    68 %------------------------------------------------------------------------   
    69 
    70 CurrentFile='/coriolis/bigone/PROJETS';%get(handles.RootDirectory,'String');
     123%------------------------------------------------------------------------
     124CurrentFile='/raid/PROJETS';%get(handles.RootDirectory,'String');
    71125set(handles.SubCampaignTest,'Value',0)
    72126CampaignDir=uigetdir(CurrentFile,'Open the Campaign directory'); %file browser
     
    74128RootDirectory_Callback(hObject, eventdata, handles)
    75129
     130%------------------------------------------------------------------------
    76131% --- Executes on button press in open_SubCampaign.
    77132function OpenSubCampaign_Callback(hObject, eventdata, handles)
     133%------------------------------------------------------------------------
    78134CurrentFile='/coriolis/bigone/PROJETS';%get(handles.RootDirectory,'String');
    79135set(handles.SubCampaignTest,'Value',1)
     
    84140
    85141%------------------------------------------------------------------------
    86 
    87142function RootDirectory_Callback(hObject, eventdata, handles)
     143%------------------------------------------------------------------------
    88144CampaignDir=get(handles.RootDirectory,'String');
     145ExpName={''};
    89146if exist(CampaignDir,'dir')
    90147    hdir=dir(CampaignDir); %list files and dirs
     
    106163    ListExperiments_Callback(hObject, eventdata, handles)
    107164else
    108     warndlg_uvmat(['The input ' CampaignDir ' is not a directory'],'ERROR')
     165    msgbox_uvmat('ERROR',['The input ' CampaignDir ' is not a directory'])
    109166end
    110167
     
    112169% --- Executes on selection change in ListExperiments.
    113170 function ListExperiments_Callback(hObject, eventdata, handles)
     171%------------------------------------------------------------------------
    114172CurrentPath=get(handles.RootDirectory,'String');
    115173ListExperiments=get(handles.ListExperiments,'String');
     
    131189set(handles.ListXml,'String',[{'*'};ListXml'])
    132190if testList
    133     hh=get(handles.ListExperiments,'parent');
    134     set(hh,'UserData',List)
     191    DataviewData=get(handles.figure,'UserData');
     192    DataView.List=List;
     193    set(handles.figure,'UserData',DataviewData)
    135194end
    136195set(handles.CampaignDoc,'Visible','on')
    137 set(handles.edit_xml,'Visible','on')
     196% set(handles.edit_xml,'Visible','on')
    138197
    139198%------------------------------------------------------------------------
     
    184243set(handles.ListExperiments,'Value',1)
    185244ListExperiments_Callback(hObject, eventdata, handles)%update the overview of the experiment directories
    186 hh=get(handles.CampaignDoc,'parent');
    187 List=get(hh,'UserData');
     245DataviewData=get(handles.figure,'UserData');
     246List=DataviewData.List;
    188247Currentpath=get(handles.RootDirectory,'String');
    189248[Currentpath,Campaign,DirExt]=fileparts(Currentpath);
     
    422481end
    423482
     483%------------------------------------------------------------------------
    424484% --- Executes on button press in HELP.
    425485function HELP_Callback(hObject, eventdata, handles)
     
    427487pathelp=fileparts(path_to_uvmat);
    428488helpfile=fullfile(pathelp,'UVMAT_DOC','uvmat_doc.html');
    429 if isempty(dir(helpfile)), errordlg('Please put the help file uvmat_doc.html in the directory UVMAT/UVMAT_DOC')
     489if isempty(dir(helpfile)), msgbox_uvmat('ERROR','Please put the help file uvmat_doc.html in the directory UVMAT/UVMAT_DOC')
    430490else
    431491web([helpfile '#dataview'])   
    432492end
    433493
    434 
    435 
    436 
    437 % --- Executes on button press in SubCampaignTest.
    438 function SubCampaignTest_Callback(hObject, eventdata, handles)
    439494
    440495
     
    456511set(handles.ListExperiments,'Value',1)
    457512ListExperiments_Callback(hObject, eventdata, handles)%update the overview of the experiment directories
    458 hh=get(handles.CampaignDoc,'parent');
    459 List=get(hh,'UserData');
     513DataviewData=get(handles.figure,'UserData');
     514List=DataviewData.List;
    460515Currentpath=get(handles.RootDirectory,'String');
    461516[Currentpath,Campaign,DirExt]=fileparts(Currentpath);
     
    510565
    511566
    512 
    513 
     567% --- Executes on button press in OK.
     568function OK_Callback(hObject, eventdata, handles)
     569%------------------------------------------------------------------------
     570CurrentPath=get(handles.RootDirectory,'String');
     571ListExperiments=get(handles.ListExperiments,'String');
     572IndicesExp=get(handles.ListExperiments,'Value');
     573if ~isequal(IndicesExp,1)
     574    ListExperiments=ListExperiments(IndicesExp);
     575end
     576ListDevices=get(handles.ListDevices,'String');
     577Value=get(handles.ListDevices,'Value');
     578if isequal(Value,1)
     579    msgbox_uvmat('ERROR','manually select in the GUI dataview the device being calibrated')
     580    return
     581else
     582    ListDevices=ListDevices(Value);
     583end
     584ListRecords=get(handles.ListRecords,'String');
     585Value=get(handles.ListRecords,'Value');
     586if ~isequal(Value,1)
     587    ListRecords=ListRecords(Value);
     588end
     589[ListDevices,ListRecords,ListXml,List]=ListDir(CurrentPath,ListExperiments,ListDevices,ListRecords);
     590ListXml=get(handles.ListXml,'String');
     591Value=get(handles.ListXml,'Value');
     592if isequal(Value,1)
     593    msgbox_uvmat('ERROR','you need to select in the GUI dataview the xml files to edit')
     594    return
     595else
     596    ListXml=ListXml(Value);
     597end
     598
     599%update all the selected xml files
     600DataviewData=get(handles.figure,'UserData');
     601% answer=msgbox_uvmat('INPUT_Y-N',[num2str(length(Value)) ' xml files for device ' ListDevices{1} ' will be refreshed with ' ...
     602%     DataviewData.GeometryCalib.CalibrationType ' calibration data'])
     603% if ~isequal(answer,'Yes')
     604%     return
     605% end
     606%List.Experiment{1}.Device{1}
     607%List.Experiment{2}.Device{1}
     608for iexp=1:length(List.Experiment)
     609    ExpName=List.Experiment{iexp}.name;
     610    set(handles.ListExperiments,'Value',IndicesExp(iexp));
     611    if isfield(List.Experiment{iexp},'Device')
     612        for idevice=1:length(List.Experiment{iexp}.Device)
     613            DeviceName=List.Experiment{iexp}.Device{idevice}.name;     
     614            if isfield(List.Experiment{iexp}.Device{idevice},'xmlfile')
     615                for ixml=1:length(List.Experiment{iexp}.Device{idevice}.xmlfile)
     616                    FileName=List.Experiment{iexp}.Device{idevice}.xmlfile{ixml};
     617                    for ilistxml=1:length(ListXml)
     618                        if isequal(FileName,ListXml{ilistxml})
     619                            set(handles.ListXml,'Value',Value(ilistxml))
     620                            drawnow
     621                            xmlfullname=fullfile(CurrentPath,ExpName,DeviceName,FileName);
     622                            update_imadoc(DataviewData.GeometryCalib,xmlfullname)
     623                            display([xmlfullname ' updated'])
     624                            break
     625                        end
     626                    end
     627                end
     628             elseif isfield(List.Experiment{iexp}.Device{idevice},'Record')
     629                for irecord=1:length(List.Experiment{iexp}.Device{idevice}.Record)
     630                    RecordName=List.Experiment{iexp}.Device{idevice}.Record{irecord}.name;
     631                    if isfield(List.Experiment{iexp}.Device{idevice}.Record{irecord},'xmlfile')
     632                        for ixml=1:length(List.Experiment{iexp}.Device{idevice}.Record{irecord}.xmlfile)
     633                            FileName=List.Experiment{iexp}.Device{idevice}.Record{irecord}.xmlfile{ixml};
     634                            for ilistxml=1:length(ListXml)
     635                                if isequal(FileName,ListXml{ilistxml})
     636                                    set(handles.ListXml,'Value',Value(ilistxml))
     637                                    drawnow
     638                                    xmlfullname=fullfile(CurrentPath,ExpName,DeviceName,RecordName,FileName);
     639                                    update_imadoc(DataviewData.GeometryCalib,xmlfullname)
     640                                    display([xmlfullname ' updated'])
     641                                    break
     642                                end
     643                            end
     644                        end
     645                    end
     646                end
     647            end
     648        end
     649    end
     650end
     651set(handles.ListXml,'Value',Value)   
     652%     
     653%     
     654%     
     655%     
     656%     
     657%     
     658%     
     659% CurrentPath=get(handles.RootDirectory,'String');%= get(hObject,'String');
     660% ListExperiments=get(handles.ListExperiments,'String');
     661% Value=get(handles.ListExperiments,'Value');
     662% if ~isequal(Value,1)
     663%     ListExperiments=ListExperiments(Value);
     664% end
     665% ListDevices=get(handles.ListDevices,'String');
     666% Value=get(handles.ListDevices,'Value');
     667% if isequal(Value,1)
     668%     msgbox_uvmat('ERROR','manually select in the GUI dataview the device being calibrated')
     669%     return
     670% else
     671%     ListDevices=ListDevices(Value);
     672% end
     673% ListRecords=get(handles.ListRecords,'String');
     674% Value=get(handles.ListRecords,'Value');
     675% if ~isequal(Value,1)
     676%     ListRecords=ListRecords(Value);
     677% end
     678% [ListDevices,ListRecords,ListXml,List]=ListDir(CurrentPath,ListExperiments,ListDevices,ListRecords);
     679% ListXml=get(handles.ListXml,'String');
     680% Value=get(handles.ListXml,'Value');
     681% if isequal(Value,1)
     682%     msgbox_uvmat('ERROR','you need to select in the GUI dataview the xml files to edit')
     683%     return
     684% else
     685%     ListXml=ListXml(Value);
     686% end
     687% handles.output.CurrentPath=CurrentPath;
     688% handles.output.ListExperiments=ListExperiments;
     689% handles.output.ListDevices=ListDevices;
     690% handles.output.ListRecords=ListRecords;
     691% handles.output.ListXml=ListXml;
     692% handles.output.List=List;
     693handles.output ='OK, Calibration replicated';
     694guidata(hObject, handles);% Update handles structure
     695uiresume(handles.figure);
     696
     697% --- Executes on button press in Cancel.
     698function Cancel_Callback(hObject, eventdata, handles)
     699handles.output = get(hObject,'String');
     700guidata(hObject, handles); % Update handles structure
     701% Use UIRESUME instead of delete because the OutputFcn needs
     702uiresume(handles.figure);
     703
     704% --- Executes when user attempts to close figure.
     705function figure_CloseRequestFcn(hObject, eventdata, handles)
     706if isequal(get(handles.figure, 'waitstatus'), 'waiting')
     707    % The GUI is still in UIWAIT, us UIRESUME
     708    uiresume(handles.figure);
     709else
     710    % The GUI is no longer waiting, just close it
     711    delete(handles.figure);
     712end
     713
     714% --- Executes on key press over figure1 with no controls selected.
     715function figure_KeyPressFcn(hObject, eventdata, handles)
     716% Check for "enter" or "escape"
     717if isequal(get(hObject,'CurrentKey'),'escape')
     718    % User said no by hitting escape
     719    handles.output = 'Cancel';
     720   
     721    % Update handles structure
     722    guidata(hObject, handles);
     723   
     724    uiresume(handles.figure);
     725end
     726if isequal(get(hObject,'CurrentKey'),'return')
     727    uiresume(handles.figure);
     728end
  • trunk/src/geometry_calib.m

    r2 r12  
    4343% Edit the above text to modify the response to help geometry_calib
    4444
    45 % Last Modified by GUIDE v2.5 28-Dec-2009 23:41:18
     45% Last Modified by GUIDE v2.5 05-Jan-2010 23:22:04
    4646
    4747% Begin initialization code - DO NOT edit
     
    7171% parameters on the uvmat interface (obtained by 'get_plot_handle.m')
    7272function geometry_calib_OpeningFcn(hObject, eventdata, handles, handles_uvmat,pos,inputfile)
    73 set(handles.Phi,'TooltipString','Phi: rotation angle of the physical point coordiantes (in degrees)')% TO PUT IN GUIDE
     73
    7474% Choose default command line output for geometry_calib
    7575handles.output = hObject;
     
    312312            uid_child=children(t,uid_calib);
    313313            t=delete(t,uid_child);
    314             testappend=1;
     314%             testappend=1;
    315315        end
    316316    end
     
    371371GeometryCalib.SourceCalib.PointCoord=Object.Coord;
    372372
     373
     374%root PROJETS
     375
    373376%open and read the dataview GUI
    374377h_dataview=findobj(allchild(0),'name','dataview');
    375 Device=[];%default
    376 if isempty(h_dataview)
    377     h_dataview=dataview;
    378     hhdataview=guidata(h_dataview);
    379     drawnow
    380     hGUI=get(handles.REPLICATE,'parent');%read the calibration image source on the interface userdata
    381     CalibData=get(hGUI,'UserData');
     378if ~isempty(h_dataview)
     379    delete(h_dataview)
     380end
     381CalibData=get(handles.figure1,'UserData');%read the calibration image source on the interface userdata
     382% filename='PROJETS';%default
     383% if isfield(CalibData,'XmlInput')
     384%      [pp,filename]=fileparts(CalibData.XmlInput);
     385% end
     386% while ~isequal(filename,'PROJETS') && numel(filename)>1
     387%     filename_1=filename;
     388%     pp_1=pp;
     389%     [pp,filename]=fileparts(pp)
     390% end
     391% projinput=fullfile(pp_1,filename_1)
     392% dd=dataview(projinput)
     393
     394%
     395% Device=[];%default
     396%
     397% h_dataview=dataview;
     398% hhdataview=guidata(h_dataview);
     399% drawnow
     400
     401if isfield(CalibData,'XmlInput')
     402    XmlInput=fileparts(CalibData.XmlInput);
     403    [XmlInput,filename,ext]=fileparts(XmlInput);
     404end
     405SubCampaignTest='n'; %default
     406testinput=0;
     407if isfield(CalibData,'Heading')
     408    Heading=CalibData.Heading;
     409    if isfield(Heading,'Record') && isequal([filename ext],Heading.Record)
     410        [XmlInput,filename,ext]=fileparts(XmlInput);
     411    end
     412    if isfield(Heading,'Device') && isequal([filename ext],Heading.Device)
     413        [XmlInput,filename,ext]=fileparts(XmlInput);
     414        Device=Heading.Device;
     415    end
     416    if isfield(Heading,'Experiment') && isequal([filename ext],Heading.Experiment)
     417        [PP,filename,ext]=fileparts(XmlInput);
     418    end
     419    testinput=0;
     420    if isfield(Heading,'SubCampaign') && isequal([filename ext],Heading.SubCampaign)
     421%         set(hhdataview.RootDirectory,'String',XmlInput)
     422%         set(hhdataview.SubCampaignTest,'Value',1)
     423        SubCampaignTest='y';
     424        testinput=1;
     425    elseif isfield(Heading,'Campaign') && isequal([filename ext],Heading.Campaign)
     426%         set(hhdataview.RootDirectory,'String',XmlInput)
     427%         set(hhdataview.SubCampaignTest,'Value',0)
     428        testinput=1;
     429    end
     430end
     431if ~testinput
     432    filename='PROJETS';%default
    382433    if isfield(CalibData,'XmlInput')
    383         XmlInput=fileparts(CalibData.XmlInput);
    384         [XmlInput,filename,ext]=fileparts(XmlInput);
    385     end
    386     if isfield(CalibData,'Heading')
    387         Heading=CalibData.Heading;
    388         if isfield(Heading,'Record') && isequal([filename ext],Heading.Record)
    389             [XmlInput,filename,ext]=fileparts(XmlInput);
    390         end
    391         if isfield(Heading,'Device') && isequal([filename ext],Heading.Device)
    392             [XmlInput,filename,ext]=fileparts(XmlInput);
    393             Device=Heading.Device;
    394         end
    395         if isfield(Heading,'Experiment') && isequal([filename ext],Heading.Experiment)
    396             [PP,filename,ext]=fileparts(XmlInput);
    397         end
    398         testinput=0;
    399         if isfield(Heading,'SubCampaign') && isequal([filename ext],Heading.SubCampaign)
    400             set(hhdataview.RootDirectory,'String',XmlInput)
    401             set(hhdataview.SubCampaignTest,'Value',1)
    402             testinput=1;
    403         elseif isfield(Heading,'Campaign') && isequal([filename ext],Heading.Campaign)
    404             set(hhdataview.RootDirectory,'String',XmlInput)
    405             set(hhdataview.SubCampaignTest,'Value',0)
    406             testinput=1;
    407         end
    408     end
    409     if testinput
    410         dataview('RootDirectory_Callback',hObject,eventdata,hhdataview)
    411         ListDevices=get(hhdataview.ListDevices,'String');
    412         for ilist=1:length(ListDevices)
    413             if isequal(ListDevices{ilist},Device)
    414                 set(hhdataview.ListDevices,'Value',ilist)
    415                 dataview('ListDevices_Callback',hObject,eventdata,hhdataview)
    416                 break
    417             end
    418         end
    419     end
    420     return
    421 end
    422 
    423 hhdataview=guidata(h_dataview);
    424 CurrentPath=get(hhdataview.RootDirectory,'String');
    425 ListExperiments=get(hhdataview.ListExperiments,'String');
    426 Value=get(hhdataview.ListExperiments,'Value');
    427 if ~isequal(Value,1)
    428     ListExperiments=ListExperiments(Value);
    429 end
    430 ListDevices=get(hhdataview.ListDevices,'String');
    431 Value=get(hhdataview.ListDevices,'Value');
    432 if isequal(Value,1)
    433     warndlg_uvmat('manually select in the GUI dataview the device being calibrated','ERROR')
    434     return
    435 else
    436     ListDevices=ListDevices(Value);
    437 end
    438 ListRecords=get(hhdataview.ListRecords,'String');
    439 Value=get(hhdataview.ListRecords,'Value');
    440 if ~isequal(Value,1)
    441     ListRecords=ListRecords(Value);
    442 end
    443 [ListDevices,ListRecords,ListXml,List]=ListDir(CurrentPath,ListExperiments,ListDevices,ListRecords);
    444 ListXml=get(hhdataview.ListXml,'String');
    445 Value=get(hhdataview.ListXml,'Value');
    446 if isequal(Value,1)
    447     warndlg_uvmat('you need to select in the GUI dataview the xml files to edit','ERROR')
    448     return
    449 else
    450     ListXml=ListXml(Value);
    451 end
    452 
    453 %update all the selected xml files
    454 answer=msgbox_uvmat('INPUT_Y-N',[num2str(length(Value)) ' xml files for device ' ListDevices{1} ' will be refreshed with ' calib_type ' calibration data']);
    455 if ~isequal(answer{1},'OK')
    456     return
    457 end
    458 % 'TEST'
    459 % List
    460 % return
    461 for iexp=1:length(List.Experiment)
    462     ExpName=List.Experiment{iexp}.name;
    463     if isfield(List.Experiment{iexp},'Device')
    464         for idevice=1:length(List.Experiment{iexp}.Device)
    465             DeviceName=List.Experiment{iexp}.Device{idevice}.name;       
    466             if isfield(List.Experiment{iexp}.Device{idevice},'xmlfile')
    467                 for ixml=1:length(List.Experiment{iexp}.Device{idevice}.xmlfile)
    468                     FileName=List.Experiment{iexp}.Device{idevice}.xmlfile{ixml};
    469                     for ilistxml=1:length(ListXml)
    470                         if isequal(FileName,ListXml{ilistxml})
    471                             set(hhdataview.ListXml,'Value',Value(ilistxml))
    472                             drawnow
    473                             xmlfullname=fullfile(CurrentPath,ExpName,DeviceName,FileName);
    474                             update_imadoc(GeometryCalib,xmlfullname)
    475                             break
    476                         end
    477                     end
    478                 end
    479              elseif isfield(List.Experiment{iexp}.Device{idevice},'Record')
    480                 for irecord=1:length(List.Experiment{iexp}.Device{idevice}.Record)
    481                     RecordName=List.Experiment{iexp}.Device{idevice}.Record{irecord}.name;
    482                     if isfield(List.Experiment{iexp}.Device{idevice}.Record{irecord},'xmlfile')
    483                         for ixml=1:length(List.Experiment{iexp}.Device{idevice}.Record{irecord}.xmlfile)
    484                             FileName=List.Experiment{iexp}.Device{idevice}.Record{irecord}.xmlfile{ixml};
    485                             for ilistxml=1:length(ListXml)
    486                                 if isequal(FileName,ListXml{ilistxml})
    487                                     set(hhdataview.ListXml,'Value',Value(ilistxml))
    488                                     drawnow
    489                                     xmlfullname=fullfile(CurrentPath,ExpName,DeviceName,RecordName,FileName);
    490                                     update_imadoc(GeometryCalib,xmlfullname)
    491                                     break
    492                                 end
    493                             end
    494                         end
    495                     end
    496                 end
    497             end
    498         end
    499     end
    500 end
    501 set(hhdataview.ListXml,'Value',Value)
    502 
    503 
    504 %-------------------------------------------------------------
    505 function update_imadoc(GeometryCalib,outputfile)
    506 testappend=0;
    507 if exist(outputfile,'file');%=1 if the output file already exists, 0 else 
    508     t=xmltree(outputfile); %read the file
    509     uid=find(t,'ImaDoc');
    510     if isequal(uid,1)%if the xml file is  ImaDoc
    511         uid_calib=find(t,'ImaDoc/GeometryCalib');
    512         if ~isempty(uid) %if GeometryCalib already exists, delete its content
    513             backupfile=outputfile;
    514             testexist=2;
    515             while testexist==2
    516                backupfile=[backupfile '~'];
    517                testexist=exist(backupfile,'file');
    518             end
    519             [success,message]=copyfile(outputfile,backupfile);%make backup
    520             if isequal(success,1)
    521                 delete(outputfile)
    522             else
    523                 return
    524             end
    525             uid_child=children(t,uid_calib);
    526             t=delete(t,uid_child);
    527             testappend=1;
    528         end
    529     end
    530 end
    531 if ~testappend
    532     t=xmltree;
    533     t=set(t,1,'name','ImaDoc');
    534     [t,uid_calib]=add(t,1,'element','GeometryCalib');
    535 %     t=struct2xml(GeometryCalib,t,uid_calib);
    536 end
    537 
    538 t=struct2xml(GeometryCalib,t,uid_calib);
    539 save(t,outputfile);
     434         [pp,filename]=fileparts(CalibData.XmlInput);
     435    end
     436    while ~isequal(filename,'PROJETS') && numel(filename)>1
     437        filename_1=filename;
     438        pp_1=pp;
     439        [pp,filename]=fileparts(pp);
     440    end
     441    XmlInput=fullfile(pp_1,filename_1);
     442    testinput=1;
     443end
     444if testinput
     445    outcome=dataview(XmlInput,SubCampaignTest,GeometryCalib)%,SubCampaignTest)
     446end
     447%     %A COMPLETER
     448%     dataview('RootDirectory_Callback',hObject,eventdata,hhdataview)
     449%     ListDevices=get(hhdataview.ListDevices,'String');
     450%     for ilist=1:length(ListDevices)
     451%         if isequal(ListDevices{ilist},Device)
     452%             set(hhdataview.ListDevices,'Value',ilist)
     453%             dataview('ListDevices_Callback',hObject,eventdata,hhdataview)
     454%             break
     455%         end
     456%     end
     457
     458% % hhdataview=guidata(h_dataview);
     459% CurrentPath=get(hhdataview.RootDirectory,'String');
     460% ListExperiments=get(hhdataview.ListExperiments,'String');
     461% Value=get(hhdataview.ListExperiments,'Value');
     462% if ~isequal(Value,1)
     463%     ListExperiments=ListExperiments(Value);
     464% end
     465% ListDevices=get(hhdataview.ListDevices,'String');
     466% Value=get(hhdataview.ListDevices,'Value');
     467% if isequal(Value,1)
     468%     msgbox_uvmat('ERROR','manually select in the GUI dataview the device being calibrated')
     469%     return
     470% else
     471%     ListDevices=ListDevices(Value);
     472% end
     473% ListRecords=get(hhdataview.ListRecords,'String');
     474% Value=get(hhdataview.ListRecords,'Value');
     475% if ~isequal(Value,1)
     476%     ListRecords=ListRecords(Value);
     477% end
     478% [ListDevices,ListRecords,ListXml,List]=ListDir(CurrentPath,ListExperiments,ListDevices,ListRecords);
     479% ListXml=get(hhdataview.ListXml,'String');
     480% Value=get(hhdataview.ListXml,'Value');
     481% if isequal(Value,1)
     482%     msgbox_uvmat('ERROR','you need to select in the GUI dataview the xml files to edit')
     483%     return
     484% else
     485%     ListXml=ListXml(Value);
     486% end
     487%
     488% %update all the selected xml files
     489% answer=msgbox_uvmat('INPUT_Y-N',[num2str(length(Value)) ' xml files for device ' ListDevices{1} ' will be refreshed with ' calib_type ' calibration data'])
     490% if ~isequal(answer,'Yes')
     491%     return
     492% end
     493% 'TESTcalib'
     494% List=DataFiles.List
     495% for iexp=1:length(List.Experiment)
     496%     ExpName=List.Experiment{iexp}.name;
     497%     if isfield(List.Experiment{iexp},'Device')
     498%         for idevice=1:length(List.Experiment{iexp}.Device)
     499%             DeviceName=List.Experiment{iexp}.Device{idevice}.name;       
     500%             if isfield(List.Experiment{iexp}.Device{idevice},'xmlfile')
     501%                 for ixml=1:length(List.Experiment{iexp}.Device{idevice}.xmlfile)
     502%                     FileName=List.Experiment{iexp}.Device{idevice}.xmlfile{ixml};
     503%                     for ilistxml=1:length(ListXml)
     504%                         if isequal(FileName,ListXml{ilistxml})
     505%                             set(hhdataview.ListXml,'Value',Value(ilistxml))
     506%                             drawnow
     507%                             xmlfullname=fullfile(CurrentPath,ExpName,DeviceName,FileName);
     508%                             update_imadoc(GeometryCalib,xmlfullname)
     509%                             break
     510%                         end
     511%                     end
     512%                 end
     513%              elseif isfield(List.Experiment{iexp}.Device{idevice},'Record')
     514%                 for irecord=1:length(List.Experiment{iexp}.Device{idevice}.Record)
     515%                     RecordName=List.Experiment{iexp}.Device{idevice}.Record{irecord}.name;
     516%                     if isfield(List.Experiment{iexp}.Device{idevice}.Record{irecord},'xmlfile')
     517%                         for ixml=1:length(List.Experiment{iexp}.Device{idevice}.Record{irecord}.xmlfile)
     518%                             FileName=List.Experiment{iexp}.Device{idevice}.Record{irecord}.xmlfile{ixml};
     519%                             for ilistxml=1:length(ListXml)
     520%                                 if isequal(FileName,ListXml{ilistxml})
     521%                                     set(hhdataview.ListXml,'Value',Value(ilistxml))
     522%                                     drawnow
     523%                                     xmlfullname=fullfile(CurrentPath,ExpName,DeviceName,RecordName,FileName);
     524%                                     update_imadoc(GeometryCalib,xmlfullname)
     525%                                     break
     526%                                 end
     527%                             end
     528%                         end
     529%                     end
     530%                 end
     531%             end
     532%         end
     533%     end
     534% end
     535% set(hhdataview.ListXml,'Value',Value)
    540536
    541537
     
    841837rotation(handles,Phi)
    842838
    843 %-----------------------------------------------------
    844 %rotation
    845 function rotation(handles,Phi)
    846 O_x=str2num(get(handles.O_x,'String'));
    847 O_y=str2num(get(handles.O_y,'String'));
    848 if isempty(O_x)
    849     O_x=0;%default
    850 end
    851 if isempty(O_y)
    852     O_y=0;%default
    853 end
    854 Coord_cell=get(handles.ListCoord,'String');
    855 data=read_geometry_calib(Coord_cell);
    856 %data=read_geometry_calib(handles);
    857 r1=cos(pi*Phi/180);
    858 r2=-sin(pi*Phi/180);
    859 r3=sin(pi*Phi/180);
    860 r4=cos(pi*Phi/180);
    861 x=data.Coord(:,1);
    862 y=data.Coord(:,2);
    863 data.Coord(:,1)=r1*x+r2*y;
    864 data.Coord(:,2)=r3*x+r4*y;
    865 % data.Coord(:,[4 5])=data.Coord(:,[4 5]);
    866 for i=1:size(data.Coord,1)
    867     for j=1:5
    868           Coord{i,j}=num2str(data.Coord(i,j),4);%phys x,y,z
    869    end
    870 end
    871 Tabchar=cell2tab(Coord,'    |    ');
    872 set(handles.ListCoord,'Value',1)
    873 set(handles.ListCoord,'String',Tabchar)
    874839
    875840
     
    10901055% --------------------------------------------------------------------
    10911056function MenuCreateGrid_Callback(hObject, eventdata, handles)
    1092 % hObject    handle to MenuCreateGrid (see GCBO)
    1093 % eventdata  reserved - to be defined in a future version of MATLAB
    1094 % handles    structure with handles and user data (see GUIDATA)
    1095 
    1096 
    1097 % --------------------------------------------------------------------
    1098 function MenuTranslatePoints_Callback(hObject, eventdata, handles)
    10991057hcalib=get(handles.calib_type,'parent');%handles of the GUI geometry_calib
    1100 CalibData=get(hcalib,'UserData')
     1058CalibData=get(hcalib,'UserData');
    11011059Tinput=[];%default
    1102 if isfield(CalibData,'translate')
    1103     Tinput=CalibData.translate;
    1104 end
    1105 T=translate_points(Tinput);%display translate_points GUI and get shift parameters
    1106 CalibData.translate=T;
     1060if isfield(CalibData,'grid')
     1061    Tinput=CalibData.grid;
     1062end
     1063T=create_grid(Tinput);%display translate_points GUI and get shift parameters
     1064CalibData.grid=T;
    11071065set(hcalib,'UserData',CalibData)
     1066
     1067%grid in phys space
    11081068Coord_cell=get(handles.ListCoord,'String');
    11091069data=read_geometry_calib(Coord_cell);
    1110 % data=read_geometry_calib(handles);
    11111070data.Coord(:,1)=T(1)+data.Coord(:,1);
    11121071data.Coord(:,2)=T(2)+data.Coord(:,2);
     
    11231082
    11241083
     1084
     1085% --------------------------------------------------------------------
     1086function MenuTranslatePoints_Callback(hObject, eventdata, handles)
     1087hcalib=get(handles.calib_type,'parent');%handles of the GUI geometry_calib
     1088CalibData=get(hcalib,'UserData')
     1089Tinput=[];%default
     1090if isfield(CalibData,'translate')
     1091    Tinput=CalibData.translate;
     1092end
     1093T=translate_points(Tinput);%display translate_points GUI and get shift parameters
     1094CalibData.translate=T;
     1095set(hcalib,'UserData',CalibData)
     1096%translation
     1097Coord_cell=get(handles.ListCoord,'String');
     1098data=read_geometry_calib(Coord_cell);
     1099data.Coord(:,1)=T(1)+data.Coord(:,1);
     1100data.Coord(:,2)=T(2)+data.Coord(:,2);
     1101data.Coord(:,3)=T(3)+data.Coord(:,3);
     1102data.Coord(:,[4 5])=data.Coord(:,[4 5]);
     1103for i=1:size(data.Coord,1)
     1104    for j=1:5
     1105          Coord{i,j}=num2str(data.Coord(i,j),4);%phys x,y,z
     1106   end
     1107end
     1108Tabchar=cell2tab(Coord,'    |    ');
     1109set(handles.ListCoord,'Value',1)
     1110set(handles.ListCoord,'String',Tabchar)
     1111
     1112
    11251113% --------------------------------------------------------------------
    11261114function MenuRotatePoints_Callback(hObject, eventdata, handles)
    1127 % hObject    handle to MenuRotatePoints (see GCBO)
    1128 % eventdata  reserved - to be defined in a future version of MATLAB
    1129 % handles    structure with handles and user data (see GUIDATA)
    1130 
    1131 
    1132 % --------------------------------------------------------------------
    1133 function Untitled_8_Callback(hObject, eventdata, handles)
    1134 % hObject    handle to Untitled_8 (see GCBO)
    1135 % eventdata  reserved - to be defined in a future version of MATLAB
    1136 % handles    structure with handles and user data (see GUIDATA)
    1137 
    1138 
    1139 
    1140 function edit27_Callback(hObject, eventdata, handles)
    1141 
    1142 
    1143 function edit28_Callback(hObject, eventdata, handles)
    1144 % hObject    handle to O_y (see GCBO)
    1145 % eventdata  reserved - to be defined in a future version of MATLAB
    1146 % handles    structure with handles and user data (see GUIDATA)
    1147 
    1148 % Hints: get(hObject,'String') returns contents of O_y as text
    1149 %        str2double(get(hObject,'String')) returns contents of O_y as a double
    1150 
    1151 
    1152 % --- Executes on button press in rotation_plus.
    1153 function pushbutton16_Callback(hObject, eventdata, handles)
    1154 % hObject    handle to rotation_plus (see GCBO)
    1155 % eventdata  reserved - to be defined in a future version of MATLAB
    1156 % handles    structure with handles and user data (see GUIDATA)
    1157 
    1158 
    1159 % --- Executes on button press in rotation_minus.
    1160 function pushbutton17_Callback(hObject, eventdata, handles)
    1161 % hObject    handle to rotation_minus (see GCBO)
    1162 % eventdata  reserved - to be defined in a future version of MATLAB
    1163 % handles    structure with handles and user data (see GUIDATA)
    1164 
    1165 
    1166 
    1167 function edit30_Callback(hObject, eventdata, handles)
    1168 % hObject    handle to Phi (see GCBO)
    1169 % eventdata  reserved - to be defined in a future version of MATLAB
    1170 % handles    structure with handles and user data (see GUIDATA)
    1171 
    1172 % Hints: get(hObject,'String') returns contents of Phi as text
    1173 %        str2double(get(hObject,'String')) returns contents of Phi as a double
    1174 
    1175 
    1176 % --- Executes during object creation, after setting all properties.
    1177 function O_y_CreateFcn(hObject, eventdata, handles)
    1178 % hObject    handle to O_y (see GCBO)
    1179 % eventdata  reserved - to be defined in a future version of MATLAB
    1180 % handles    empty - handles not created until after all CreateFcns called
    1181 
    1182 % Hint: edit controls usually have a white background on Windows.
    1183 %       See ISPC and COMPUTER.
    1184 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    1185     set(hObject,'BackgroundColor','white');
    1186 end
    1187 
    1188 
    1189 % --- Executes during object creation, after setting all properties.
    1190 function O_x_CreateFcn(hObject, eventdata, handles)
    1191 % hObject    handle to O_x (see GCBO)
    1192 % eventdata  reserved - to be defined in a future version of MATLAB
    1193 % handles    empty - handles not created until after all CreateFcns called
    1194 
    1195 % Hint: edit controls usually have a white background on Windows.
    1196 %       See ISPC and COMPUTER.
    1197 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    1198     set(hObject,'BackgroundColor','white');
    1199 end
    1200 
    1201 
    1202 % --- Executes during object creation, after setting all properties.
    1203 function T_x_CreateFcn(hObject, eventdata, handles)
    1204 % hObject    handle to T_x (see GCBO)
    1205 % eventdata  reserved - to be defined in a future version of MATLAB
    1206 % handles    empty - handles not created until after all CreateFcns called
    1207 
    1208 % Hint: edit controls usually have a white background on Windows.
    1209 %       See ISPC and COMPUTER.
    1210 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    1211     set(hObject,'BackgroundColor','white');
    1212 end
    1213 
    1214 
    1215 % --- Executes during object creation, after setting all properties.
    1216 function T_y_CreateFcn(hObject, eventdata, handles)
    1217 % hObject    handle to T_y (see GCBO)
    1218 % eventdata  reserved - to be defined in a future version of MATLAB
    1219 % handles    empty - handles not created until after all CreateFcns called
    1220 
    1221 % Hint: edit controls usually have a white background on Windows.
    1222 %       See ISPC and COMPUTER.
    1223 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    1224     set(hObject,'BackgroundColor','white');
    1225 end
    1226 
    1227 
    1228 % --- Executes during object creation, after setting all properties.
    1229 function T_z_CreateFcn(hObject, eventdata, handles)
    1230 % hObject    handle to T_z (see GCBO)
    1231 % eventdata  reserved - to be defined in a future version of MATLAB
    1232 % handles    empty - handles not created until after all CreateFcns called
    1233 
    1234 % Hint: edit controls usually have a white background on Windows.
    1235 %       See ISPC and COMPUTER.
    1236 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    1237     set(hObject,'BackgroundColor','white');
    1238 end
    1239 
    1240 
    1241 
    1242 function edit31_Callback(hObject, eventdata, handles)
    1243 % hObject    handle to edit31 (see GCBO)
    1244 % eventdata  reserved - to be defined in a future version of MATLAB
    1245 % handles    structure with handles and user data (see GUIDATA)
    1246 
    1247 % Hints: get(hObject,'String') returns contents of edit31 as text
    1248 %        str2double(get(hObject,'String')) returns contents of edit31 as a double
    1249 
    1250 
    1251 % --- Executes during object creation, after setting all properties.
    1252 function edit31_CreateFcn(hObject, eventdata, handles)
    1253 % hObject    handle to edit31 (see GCBO)
    1254 % eventdata  reserved - to be defined in a future version of MATLAB
    1255 % handles    empty - handles not created until after all CreateFcns called
    1256 
    1257 % Hint: edit controls usually have a white background on Windows.
    1258 %       See ISPC and COMPUTER.
    1259 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    1260     set(hObject,'BackgroundColor','white');
    1261 end
    1262 
    1263 
    1264 
    1265 function edit32_Callback(hObject, eventdata, handles)
    1266 % hObject    handle to edit32 (see GCBO)
    1267 % eventdata  reserved - to be defined in a future version of MATLAB
    1268 % handles    structure with handles and user data (see GUIDATA)
    1269 
    1270 % Hints: get(hObject,'String') returns contents of edit32 as text
    1271 %        str2double(get(hObject,'String')) returns contents of edit32 as a double
    1272 
    1273 
    1274 % --- Executes during object creation, after setting all properties.
    1275 function edit32_CreateFcn(hObject, eventdata, handles)
    1276 % hObject    handle to edit32 (see GCBO)
    1277 % eventdata  reserved - to be defined in a future version of MATLAB
    1278 % handles    empty - handles not created until after all CreateFcns called
    1279 
    1280 % Hint: edit controls usually have a white background on Windows.
    1281 %       See ISPC and COMPUTER.
    1282 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    1283     set(hObject,'BackgroundColor','white');
    1284 end
    1285 
    1286 
    1287 
    1288 function edit33_Callback(hObject, eventdata, handles)
    1289 % hObject    handle to edit33 (see GCBO)
    1290 % eventdata  reserved - to be defined in a future version of MATLAB
    1291 % handles    structure with handles and user data (see GUIDATA)
    1292 
    1293 % Hints: get(hObject,'String') returns contents of edit33 as text
    1294 %        str2double(get(hObject,'String')) returns contents of edit33 as a double
    1295 
    1296 
    1297 % --- Executes on button press in pushbutton18.
    1298 function pushbutton18_Callback(hObject, eventdata, handles)
    1299 % hObject    handle to pushbutton18 (see GCBO)
    1300 % eventdata  reserved - to be defined in a future version of MATLAB
    1301 % handles    structure with handles and user data (see GUIDATA)
    1302 
    1303 
    1304 % --- Executes on button press in pushbutton19.
    1305 function pushbutton19_Callback(hObject, eventdata, handles)
    1306 % hObject    handle to pushbutton19 (see GCBO)
    1307 % eventdata  reserved - to be defined in a future version of MATLAB
    1308 % handles    structure with handles and user data (see GUIDATA)
    1309 
    1310 
    1311 
    1312 
     1115hcalib=get(handles.calib_type,'parent');%handles of the GUI geometry_calib
     1116CalibData=get(hcalib,'UserData')
     1117Tinput=[];%default
     1118if isfield(CalibData,'rotate')
     1119    Tinput=CalibData.rotate;
     1120end
     1121T=rotate_points(Tinput);%display translate_points GUI and get shift parameters
     1122CalibData.rotate=T;
     1123set(hcalib,'UserData',CalibData)
     1124%-----------------------------------------------------
     1125%rotation
     1126Phi=T(1);
     1127O_x=0;%default
     1128O_y=0;%default
     1129if numel(T)>=2
     1130    O_x=T(2);%default
     1131end
     1132if numel(T)>=3
     1133    O_y=T(3);%default
     1134end
     1135Coord_cell=get(handles.ListCoord,'String');
     1136data=read_geometry_calib(Coord_cell);
     1137r1=cos(pi*Phi/180);
     1138r2=-sin(pi*Phi/180);
     1139r3=sin(pi*Phi/180);
     1140r4=cos(pi*Phi/180);
     1141x=data.Coord(:,1)-O_x;
     1142y=data.Coord(:,2)-O_y;
     1143data.Coord(:,1)=r1*x+r2*y;
     1144data.Coord(:,2)=r3*x+r4*y;
     1145% data.Coord(:,[4 5])=data.Coord(:,[4 5]);
     1146for i=1:size(data.Coord,1)
     1147    for j=1:5
     1148          Coord{i,j}=num2str(data.Coord(i,j),4);%phys x,y,z
     1149   end
     1150end
     1151Tabchar=cell2tab(Coord,'    |    ');
     1152set(handles.ListCoord,'Value',1)
     1153set(handles.ListCoord,'String',Tabchar)
     1154
     1155
  • trunk/src/get_field.m

    r5 r12  
    2222function varargout = get_field(varargin)
    2323
    24 % Last Modified by GUIDE v2.5 08-Jan-2010 15:15:06
     24% Last Modified by GUIDE v2.5 06-Feb-2010 09:58:13
    2525
    2626% Begin initialization code - DO NOT EDIT
     
    5656guidata(hObject, handles);
    5757pathuvmat=fileparts(which('uvmat'));
    58 % addpath(fullfile(pathuvmat,'FIELD_FCT'))
     58addpath(fullfile(pathuvmat,'FIELD_FCT'))
    5959set(handles.attributes,'enable','on')% TO BE SET BY GUIDE
    6060set(hObject,'WindowButtonUpFcn',{@mouse_up_gui,handles})%set mouse click action function
     
    113113
    114114
    115 
    116 
    117 
    118 
    119115%-----------------------------------------------------------
    120116% --- Outputs from this function are returned to the command line.
     
    125121% --- Executes on button press in browse.
    126122function browse_Callback(hObject, eventdata, handles)
    127 
    128 
    129123
    130124
     
    768762end
    769763haxes=findobj(hfig,'Type','axes');
    770 
    771764plot_field(SubField,haxes)
    772765end
     
    14841477list_path=get(handles.ACTION,'UserData');
    14851478nb_builtin=0;
    1486 list_path
    14871479if iscell(list_path)
    1488 for ilist=1:length(list_path)
    1489     if isequal(list_path{ilist},path_get_field)
    1490         nb_builtin=nb_builtin+1;
    1491     else
    1492         break
    1493     end
    1494 end
     1480    for ilist=1:length(list_path)
     1481        if isequal(list_path{ilist},path_get_field)
     1482            nb_builtin=nb_builtin+1;
     1483        else
     1484            break
     1485        end
     1486    end
    14951487end
    14961488if nb_builtin==0% the path to get_field has been changed, reinitialize
     
    16521644%default setting for the visibility of the GUI elements*
    16531645if ~isequal(ACTION,'PLOT')
    1654     varargout=feval(ACTION);% input list asked by the selected function
     1646    varargout=feval(ACTION)% input list asked by the selected function
    16551647    test_1Dplot=[];
    16561648    test_scalar=[];
    16571649    test_vector=[];
    1658     for ilist=1:length(varargout)-1
    1659         switch varargout{ilist}
     1650    for ilist=1:length(varargout)
     1651        switch varargout{ilist,1}
    16601652                           %RootFile always visible
    16611653            case 'check_1Dplot'   
    1662                  test_1Dplot=isequal(lower(varargout{ilist+1}),'y');
     1654                 test_1Dplot=isequal(lower(varargout{ilist,2}),'y')
    16631655            case 'check_scalar'
    1664                  test_scalar=isequal(lower(varargout{ilist+1}),'y');   
     1656                 test_scalar=isequal(lower(varargout{ilist,2}),'y')   
    16651657            case 'check_vector'   
    1666                  test_vector=isequal(lower(varargout{ilist+1}),'y');
     1658                 test_vector=isequal(lower(varargout{ilist,2}),'y')
    16671659        end
    16681660    end
     
    17251717% end
    17261718
    1727 % --- Executes on selection change in menu_coord.
    1728 function HELP_Callback(hObject, eventdata, handles)
    1729 path_to_uvmat=which ('uvmat');% check the path of uvmat
    1730 pathelp=fileparts(path_to_uvmat);
    1731 helpfile=fullfile(pathelp,'UVMAT_DOC','uvmat_doc.html');
    1732 if isempty(dir(helpfile)), errordlg('Please put the help file uvmat_doc.html in the directory UVMAT/UVMAT_DOC')
    1733 else
    1734 web([helpfile '#get_field'])   
    1735 end
     1719
    17361720
    17371721%-----------------------------------------------------
     
    18831867testblank=findstr(fileinput,' ');%look for blanks
    18841868if ~isempty(testblank)
    1885     warndlg_uvmat(['The input file name ' fileinput ' contains blank character : This is not allowed. Please change name'],'ERROR')
     1869    msgbox_uvmat('ERROR',['The input file name ' fileinput ' contains blank character : This is not allowed. Please change name'])
    18861870    return
    18871871end
     
    19171901% --------------------------------------------------------------------
    19181902function MenuFile_1_Callback(hObject, eventdata, handles)
    1919 % hObject    handle to MenuFile_1 (see GCBO)
     1903fileinput=get(handles.MenuFile_1,'Label');
     1904set(handles.inputfile,'String',fileinput)
     1905inputfile_Callback(hObject, eventdata, handles)
     1906
     1907% --------------------------------------------------------------------
     1908function MenuFile_2_Callback(hObject, eventdata, handles)
     1909fileinput=get(handles.MenuFile_2,'Label');
     1910set(handles.inputfile,'String',fileinput)
     1911inputfile_Callback(hObject, eventdata, handles)
     1912
     1913% --------------------------------------------------------------------
     1914function MenuFile_3_Callback(hObject, eventdata, handles)
     1915fileinput=get(handles.MenuFile_3,'Label');
     1916set(handles.inputfile,'String',fileinput)
     1917inputfile_Callback(hObject, eventdata, handles)
     1918
     1919% --------------------------------------------------------------------
     1920function MenuFile_4_Callback(hObject, eventdata, handles)
     1921fileinput=get(handles.MenuFile_4,'Label');
     1922set(handles.inputfile,'String',fileinput)
     1923inputfile_Callback(hObject, eventdata, handles)
     1924
     1925% --------------------------------------------------------------------
     1926function MenuFile_5_Callback(hObject, eventdata, handles)
     1927fileinput=get(handles.MenuFile_5,'Label');
     1928set(handles.inputfile,'String',fileinput)
     1929inputfile_Callback(hObject, eventdata, handles)
     1930
     1931% --------------------------------------------------------------------
     1932function MenuExportField_Callback(hObject, eventdata, handles)
     1933
     1934
     1935% --------------------------------------------------------------------
     1936function MenuHelp_Callback(hObject, eventdata, handles)
     1937% hObject    handle to MenuHelp (see GCBO)
    19201938% eventdata  reserved - to be defined in a future version of MATLAB
    19211939% handles    structure with handles and user data (see GUIDATA)
    1922 
    1923 
    1924 % --------------------------------------------------------------------
    1925 function MenuFile_2_Callback(hObject, eventdata, handles)
    1926 % hObject    handle to MenuFile_2 (see GCBO)
    1927 % eventdata  reserved - to be defined in a future version of MATLAB
    1928 % handles    structure with handles and user data (see GUIDATA)
    1929 
    1930 
    1931 % --------------------------------------------------------------------
    1932 function MenuFile_3_Callback(hObject, eventdata, handles)
    1933 % hObject    handle to MenuFile_3 (see GCBO)
    1934 % eventdata  reserved - to be defined in a future version of MATLAB
    1935 % handles    structure with handles and user data (see GUIDATA)
    1936 
    1937 
    1938 % --------------------------------------------------------------------
    1939 function MenuFile_4_Callback(hObject, eventdata, handles)
    1940 % hObject    handle to MenuFile_4 (see GCBO)
    1941 % eventdata  reserved - to be defined in a future version of MATLAB
    1942 % handles    structure with handles and user data (see GUIDATA)
    1943 
    1944 
    1945 % --------------------------------------------------------------------
    1946 function MenuFile_5_Callback(hObject, eventdata, handles)
    1947 % hObject    handle to MenuFile_5 (see GCBO)
    1948 % eventdata  reserved - to be defined in a future version of MATLAB
    1949 % handles    structure with handles and user data (see GUIDATA)
    1950 
    1951 
    1952 % --------------------------------------------------------------------
    1953 function ExportField_Callback(hObject, eventdata, handles)
    1954 % hObject    handle to ExportField (see GCBO)
    1955 % eventdata  reserved - to be defined in a future version of MATLAB
    1956 % handles    structure with handles and user data (see GUIDATA)
     1940path_to_uvmat=which ('uvmat');% check the path of uvmat
     1941pathelp=fileparts(path_to_uvmat);
     1942helpfile=fullfile(pathelp,'UVMAT_DOC','uvmat_doc.html');
     1943if isempty(dir(helpfile)), msgbox_uvmat('ERROR','Please put the help file uvmat_doc.html in the directory UVMAT/UVMAT_DOC')
     1944else
     1945web([helpfile '#get_field'])   
     1946end
     1947
  • trunk/src/mouse_up.m

    r11 r12  
    194194                    set(hfig2,'DeleteFcn',{@close_fig,AxeData.CurrentRectZoom,'zoom'})
    195195                    set(hfig2,'UserData',AxeData.CurrentRectZoom)% record the parent object (zoom rectangle) in the new fig
     196                    %UvData.Plane2.Axes=copyobj(currentaxes,hfig2); %copy the current graph axes to the zoom figure 
    196197                    AxeData.ZoomAxes=copyobj(currentaxes,hfig2); %copy the current graph axes to the zoom figure
    197198                    figure(hfig2)
  • trunk/src/msgbox_uvmat.m

    r2 r12  
    142142else
    143143    varargout{1}=get(handles.edit_box,'String');
    144     isequal(varargout{1},'')
    145144    if isempty(varargout{1}) || isequal(varargout{1},'')
    146145        varargout{1}='Yes';
  • trunk/src/series.m

    r2 r12  
    19991999                            % check the content  netcdf file
    20002000                            Data=nc2struct(file,'ListGlobalAttribute','patch2','fix2','civ2','patch','fix','absolut_time_T0','hart');
    2001                             lastfield='civ1'; %default
    20022001                            if ~isempty(Data.patch2) && isequal(Data.patch2,1)
    20032002                                lastfield='patch2';
     
    20122011                            elseif ~isempty(Data.absolut_time_T0) && ~isempty(Data.hart)
    20132012                                lastfield='civ1';
    2014                             end   
    2015 %                             Data=nc2struct(file,[]);       
    2016 %                              lastfield='civ1'; %default
    2017 %                             if isfield(Data,'patch2') & isequal(Data.patch2,1);
    2018 %                                 lastfield='patch2';
    2019 %                             elseif isfield(Data,'fix2') & isequal(Data.fix2,1);
    2020 %                                 lastfield='fix2';
    2021 %                             elseif isfield(Data,'civ2') & isequal(Data.civ2,1);
    2022 %                                 lastfield='civ2';
    2023 %                             elseif isfield(Data,'patch') & isequal(Data.patch,1);
    2024 %                                 lastfield='patch1';
    2025 %                             elseif isfield(Data,'fix') & isequal(Data.fix,1);
    2026 %                                 lastfield='fix1';
    2027 %                             elseif isfield(Data,'absolut_time_T0') & isfield(Data,'hart')
    2028 %                                 lastfield='civ1';
    2029 %                             end   
    2030                          
     2013                            end                         
    20312014                        end
    20322015                    end
     
    22222205           return
    22232206        end
    2224         hhget_field=guidata(hget_field);%handles of GUI elements in get_field
    2225         SubField=read_var_names(hhget_field); %read the names of the variables to plot in the get_field GUI
     2207        %hhget_field=guidata(hget_field);%handles of GUI elements in get_field
     2208        SubField=read_get_field(hget_field); %read the names of the variables to plot in the get_field GUI
    22262209    end
    22272210end
     
    25662549hget_field=findobj(allchild(0),'name','get_field');%find the get_field... GUI
    25672550delete(hget_field)
     2551'TEST'
    25682552uvmat(filemean)
    25692553
     
    30353019if isequal(FieldName,'get_field...')
    30363020    hget_field=findobj(allchild(0),'Name','get_field');%find the get_field... GUI
    3037     hhget_field=guidata(hget_field);%handles of GUI elements in get_field
    3038     SubField=get_field('read_var_names',hObject,eventdata,hhget_field); %read the names of the variables to plot in the get_field GUI
    3039     if isequal(get(hhget_field.menu_coord,'Visible'),'on')
    3040         list_transform=get(hhget_field.menu_coord,'String');
    3041         val_list=get(hhget_field.menu_coord,'Value');
    3042         transform=list_transform{val_list};
    3043     end
     3021   % hhget_field=guidata(hget_field);%handles of GUI elements in get_field
     3022    SubField=get_field('read_get_field',hObject,eventdata,hget_field); %read the names of the variables to plot in the get_field GUI
     3023%     if isequal(get(hhget_field.menu_coord,'Visible'),'on')
     3024%         list_transform=get(hhget_field.menu_coord,'String');
     3025%         val_list=get(hhget_field.menu_coord,'Value');
     3026%         transform=list_transform{val_list};
     3027%     end
    30443028end
    30453029%detect whether all the files are 'images' or 'netcdf'
     
    33033287    else
    33043288        if length(ivar_Y)~=1
    3305                 msgbox_uvmat('ERROR','y coordinate missing in proj_field.m')
     3289                warndlg_uvmat('y coordinate missing in proj_field.m','ERROR')
    33063290                return
    33073291        end
    33083292        test_grid=0;
    33093293    end
    3310  %   DimIndices=Data{1}.VarDimIndex{VarIndex(1)};%indices of the dimensions of the first variable (common to all variables in the cell)
     3294%    DimIndices=Data{1}.VarDimIndex{VarIndex(1)};%indices of the dimensions of the first variable (common to all variables in the cell)
    33113295    %case of input fields with unstructured coordinates
    33123296    if ~test_grid
     
    33193303    %case of fields defined on a structured  grid
    33203304    else 
    3321 %         DimValue=MergeData.DimValue(DimIndices);%set of dimension values
     3305%        DimValue=MergeData.DimValue(DimIndices);%set of dimension values
    33223306        testFF=0;
    33233307        for iview=2:nbview
     
    36603644if test_object%isfield(Series,'sethandles')
    36613645    Series.ProjObject=read_set_object(Series.sethandles);
    3662     answeryes=questdlg({['field series projected on ' Series.ProjObject.Style]});
     3646    %answeryes=questdlg({['field series projected on ' Series.ProjObject.Style]});
     3647    answeryes=msgbox_uvmat('INPUT_Y-N',['field series projected on ' Series.ProjObject.Style]);
    36633648    if ~isequal(answeryes,'Yes')
    36643649        return
     
    36983683%Number of input series: this function  accepts only a single input file series
    36993684nbview=length(RootPath);
    3700 if nbview>2 
    3701     RootPath=RootPath(1:2);
    3702     set(hseries.RootPath,'String',RootPath)
    3703     SubDir=SubDir(1:2);
    3704     set(hseries.SubDir,'String',SubDir)
    3705     RootFile=RootFile(1:2);
    3706     set(hseries.RootFile,'String',RootFile)
    3707     NomType=NomType(1:2);
    3708     %set(hseries.NomType,'String',NomType)
    3709     FileExt=FileExt(1:2);
    3710     set(hseries.FileExt,'String',FileExt)
    3711     nbview=2;
     3685if nbview==2
     3686    %TODO: choose between difference and two series
     3687elseif nbview>2  % TODO: make multiple series
     3688%     RootPath=RootPath(1:2);
     3689%     set(hseries.RootPath,'String',RootPath)
     3690%     SubDir=SubDir(1:2);
     3691%     set(hseries.SubDir,'String',SubDir)
     3692%     RootFile=RootFile(1:2);
     3693%     set(hseries.RootFile,'String',RootFile)
     3694%     NomType=NomType(1:2);
     3695%     %set(hseries.NomType,'String',NomType)
     3696%     FileExt=FileExt(1:2);
     3697%     set(hseries.FileExt,'String',FileExt)
     3698%     nbview=2;
    37123699end
    37133700hhh=which('mmreader');
     
    37223709end
    37233710filebase{1}=fullfile(RootPath{1},RootFile{1});
    3724 % FileDisplay=fullfile(RootPath{1},SubDir{1},RootFile{1});
    37253711
    37263712% number of slices
     
    37393725if isequal(FieldName,{'get_field...'})
    37403726    hget_field=findobj(allchild(0),'name','get_field');%find the get_field... GUI
    3741     if length(hget_field)>1
    3742         delete(hget_field(2:end))
     3727    if numel(hget_field)>1
     3728        delete(hget_field(2:end)) % delete multiple occurerence of the GUI get_fioeld
    37433729    elseif isempty(hget_field)
    3744        filename=...
    3745                name_generator(filebase{1},num_i1{1}(1),num_j1{1}(1),FileExt{1},NomType{1},1,num_i2{1}(1),num_j2{1}(1),SubDir{1});
     3730       filename=name_generator(filebase{1},num_i1{1}(1),num_j1{1}(1),FileExt{1},NomType{1},1,num_i2{1}(1),num_j2{1}(1),SubDir{1});
    37463731       idetect(iview)=exist(filename,'file');
    37473732       hget_field=get_field(filename);
    37483733       return
    37493734    end
    3750     hhget_field=guidata(hget_field);%handles of GUI elements in get_field
    3751     SubField=read_var_names(hhget_field); %read the names of the variables to plot in the get_field GUI
    3752     if isequal(get(hhget_field.menu_coord,'Visible'),'on')
    3753         list_transform=get(hhget_field.menu_coord,'String');
    3754         val_list=get(hhget_field.menu_coord,'Value');
    3755         transform=list_transform{val_list};
    3756     end
     3735    %hhget_field=guidata(hget_field);%handles of GUI elements in get_field
     3736    SubField=read_get_field(hget_field) %read the names of the variables to plot in the get_field GUI
     3737    if isempty(SubField)
     3738        delete(hget_field)
     3739       filename=name_generator(filebase{1},num_i1{1}(1),num_j1{1}(1),FileExt{1},NomType{1},1,num_i2{1}(1),num_j2{1}(1),SubDir{1});
     3740        hget_field=get_field(filename);
     3741        SubField=read_get_field(hget_field); %read the names of the variables to plot in the get_field GUI
     3742    end
     3743%     if isequal(get(hhget_field.menu_coord,'Visible'),'on')
     3744%         list_transform=get(hhget_field.menu_coord,'String');
     3745%         val_list=get(hhget_field.menu_coord,'Value');
     3746%         transform=list_transform{val_list};
     3747%     end
    37573748end
    37583749
     
    37943785    increment=num_i1{1}(2)-num_i1{1}(1);
    37953786    if ~isequal(increment,1) % if an increment is set
    3796         answeryes=msgbox_uvmat('INPUT_Y-N',['will take time series in ' num2str(NbSlice) 'slices with increment = ' num2str(increment) '!'])
     3787        answeryes=msgbox_uvmat('INPUT_Y-N',['will take time series in ' num2str(NbSlice) 'slices with increment = ' num2str(increment) '!']);
    37973788    else   
    37983789        answeryes=msgbox_uvmat('INPUT_Y-N',{['will take time series in ' num2str(NbSlice) ' slices'];['results stored as files ' filebase_out ' ...']});
     
    39303921                    nbcolor=size(A,3);
    39313922                    if nbcolor==3
    3932 %                         Data{iview}.ListDimName={'coord_y','coord_x','rgb'};
    3933 %                         Data{iview}.DimValue=[npy npx 3];
    3934 %                         Data{iview}.VarDimIndex={[1 2 3]};
    3935                            Data{iview}.VarDimName={'coord_y','coord_x',{'coord_y','coord_x','rgb'}};
     3923                         Data{iview}.VarDimName={'coord_y','coord_x',{'coord_y','coord_x','rgb'}};
    39363924                    else
    3937 %                         Data{iview}.ListDimName={'coord_y','coord_x'}; 
    3938 %                         Data{iview}.DimValue=[npy npx];
    3939 %                         Data{iview}.VarDimIndex={[1 2]};
    3940 %                         Data{iview}.VarAttribute{1}.Coord_1=[npy-0.5 0.5];
    3941 %                         Data{iview}.VarAttribute{1}.Coord_2=[0.5 npx-0.5];
    39423925                         Data{iview}.VarDimName={'coord_y','coord_x',{'coord_y','coord_x'}};
    39433926                    end 
     
    39803963            end
    39813964            if isfield(Series,'ProjObject')
     3965                Series.ProjObject
    39823966                [Field,errormsg]=proj_field(Field,Series.ProjObject);
    39833967                if ~isempty(errormsg)
     
    40224006                                    DimCell={DimCell};
    40234007                                end
    4024                                 if numel(DimCell)==1 && isequal(Field.ListVarName{ivar},DimCell)%TODO generalise with attribute
    4025                                % if length(Field.ListDimName)>=index & isequal(Field.ListVarName{ivar},Field.ListDimName{index})%detect dimension variables
     4008                                if numel(DimCell)==1 && isequal(Field.ListVarName{ivar},DimCell{1})%detect dimension variables
    40264009                                   testsum(ivar)=1;
    40274010                                end
     
    40344017                        end
    40354018                    end
    4036                  %   RecordData.ListDimName=[{'Time'} RecordData.ListDimName];%name of dimension
    40374019                    RecordData.ListVarName=[{'Time'} RecordData.ListVarName];
    40384020                end
     
    40504032                        end
    40514033                        VarVal=shiftdim(VarVal,-1); %shift dimension
    4052                         eval(['RecordData.' VarName '=cat(1,RecordData.' VarName ',VarVal);']);%concanete the current field to the time series                     
     4034                        eval(['RecordData.' VarName '=cat(1,RecordData.' VarName ',VarVal);']);%concanete the current field to the time series   
    40534035                    elseif testsum(ivar)==1% variable representing fixed coordinates
    40544036                        eval(['VarInit=RecordData.' VarName ';']);
     
    41174099    [filemean]=...
    41184100               name_generator(filebase_out,num_i1{1}(i_slice),num_j1{1}(i_slice),'.nc','_i1-i2_j1-j2',1,num_i2{end}(ifile),num_j2{end}(ifile),SubDir{1});
    4119     RecordData
    4120      RecordData.VarDimName{1}
    4121      RecordData.VarDimName{2}
    4122       RecordData.VarDimName{3}
    41234101    errormsg=struct2nc(filemean,RecordData); %save result file
    41244102    if isempty(errormsg)
     
    44424420                            time_first=Attrib.absolut_time_T0;
    44434421                        end
    4444                         if isfield(Attrib,'absolut_time_T0_2')&~(isequal(VelType,'civ1')|isequal(VelType,'interp1')|isequal(VelType,'filter1'))
     4422                        if isfield(Attrib,'absolut_time_T0_2')&&~(isequal(VelType,'civ1')||isequal(VelType,'interp1')||isequal(VelType,'filter1'))
    44454423                            time_first=Attrib.absolut_time_T0_2;
    44464424                        end
     
    44564434                            time_last=Attrib.absolut_time_T0;
    44574435                        end
    4458                         if isfield(Attrib,'absolut_time_T0_2')&~(isequal(VelType,'civ1')|isequal(VelType,'interp1')|isequal(VelType,'filter1'))
     4436                        if isfield(Attrib,'absolut_time_T0_2')&&~(isequal(VelType,'civ1')||isequal(VelType,'interp1')||isequal(VelType,'filter1'))
    44594437                            time_last=Attrib.absolut_time_T0_2;
    44604438                        end
  • trunk/src/translate_points.m

    r2 r12  
    1616function varargout = translate_points(varargin)
    1717
    18 % Last Modified by GUIDE v2.5 05-Jan-2010 09:49:31
     18% Last Modified by GUIDE v2.5 05-Jan-2010 19:31:33
    1919
    2020% Begin initialization code - DO NOT EDIT
     
    163163
    164164
    165 
    166 
     165function edit5_Callback(hObject, eventdata, handles)
     166% hObject    handle to edit5 (see GCBO)
     167% eventdata  reserved - to be defined in a future version of MATLAB
     168% handles    structure with handles and user data (see GUIDATA)
     169
     170% Hints: get(hObject,'String') returns contents of edit5 as text
     171%        str2double(get(hObject,'String')) returns contents of edit5 as a double
     172
     173
     174
     175function edit6_Callback(hObject, eventdata, handles)
     176% hObject    handle to edit6 (see GCBO)
     177% eventdata  reserved - to be defined in a future version of MATLAB
     178% handles    structure with handles and user data (see GUIDATA)
     179
     180% Hints: get(hObject,'String') returns contents of edit6 as text
     181%        str2double(get(hObject,'String')) returns contents of edit6 as a
     182%        double
     183
     184
     185function edit7_Callback(hObject, eventdata, handles)
     186% hObject    handle to edit7 (see GCBO)
     187% eventdata  reserved - to be defined in a future version of MATLAB
     188% handles    structure with handles and user data (see GUIDATA)
     189
     190% Hints: get(hObject,'String') returns contents of edit7 as text
     191%        str2double(get(hObject,'String')) returns contents of edit7 as a double
     192
     193
     194function edit8_Callback(hObject, eventdata, handles)
     195% hObject    handle to edit8 (see GCBO)
     196% eventdata  reserved - to be defined in a future version of MATLAB
     197% handles    structure with handles and user data (see GUIDATA)
     198
     199% Hints: get(hObject,'String') returns contents of edit8 as text
     200%        str2double(get(hObject,'String')) returns contents of edit8 as a double
     201
     202
Note: See TracChangeset for help on using the changeset viewer.