Changeset 127


Ignore:
Timestamp:
Nov 19, 2010, 10:44:24 AM (13 years ago)
Author:
sommeria
Message:

merge_proj.m: cleaning
sub_field.m: ?
dataview.m: modifs not finished
name-generator: bug repair for new nom_type
nc2struct: cleaning
uvmat: cleaning
read_civxdata: transform all variables to double
civ: bug repair for new nom_type, not finished

Location:
trunk/src
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/civ.m

    r122 r127  
    453453filebase=get(handles.RootName,'String');
    454454ext=get(handles.ImaDoc,'String');
    455 browse=get(handles.browse_root,'UserData');%default
     455browse=get(handles.browse_root,'UserData')%default
    456456if isfield(browse,'nom_type_ima')
    457457    nom_type_ima=browse.nom_type_ima;% get an image nomenclature type already determined by an input image name
     
    548548        nbfield=size(time,1);
    549549        nbfield2=size(time,2);
    550         %transform .Time to a column vector if it is a line vector the nomenclature uses a single index
     550        %transform .Time to a column vector if it is a line vector thenomenclature uses a single index: correct possible bug in xml
    551551        if isequal(nbfield,1) && ~isequal(nbfield2,1)% .Time is a line vector
    552             if numel(nom_type_read)>=2 && (strcmp(nom_type_read,'_i')||strcmp(nom_type_read(1:2),'%0')||strcmp(nom_type_read(1:2),'_%'))
     552            if numel(nom_type_read)>=2 && isempty(regexp(nom_type_read(2:end),'\D'))
    553553                time=time';
    554554                nbfield=nbfield2;
     
    20592059%check the list of operations:
    20602060operations={'CIV1','FIX1','PATCH1','CIV2','FIX2','PATCH2'};
    2061 run_flag=1;
     2061% run_flag=1;
    20622062box_test(1)=get(handles.CIV1,'Value');
    20632063box_test(2)=get(handles.FIX1,'Value');
     
    21212121    s=convert(t);
    21222122end
    2123     test_interp=0;
    2124     if batch
     2123test_interp=0;
     2124if batch
    21252125    if isfield(s,'BatchParam')
    21262126        sparam=s.BatchParam;
     
    21672167    % end
    21682168    if isfield(sparam,'FixBin')
    2169         %     fixBin=sparam.FixBin;
    21702169        if ~exist(sparam.FixBin,'file')
    21712170            sparam.FixBin=fullfile(path_UVMAT,sparam.FixBin);
     
    22182217else
    22192218    if isunix
    2220         [s,w]=unix('ps faux |grep civ|wc -l');
     2219        [xx,w]=unix('ps faux |grep civ|wc -l');
    22212220        w(end)=[];
    2222         if str2num(w)+numel(num1_civ1)> MaxCivProcesses
     2221        if str2double(w)+numel(num1_civ1)> MaxCivProcesses
    22232222            msgbox_uvmat('ERROR',{['There are already ' w ' civ processes running locally'];'Use BATCH or submit RUN later'})
    22242223            return
     
    22412240    flagindex1(2)=get(handles.vec_F3, 'Value');
    22422241    flagindex1(3)=get(handles.vec_F2, 'Value');
    2243     thresh_vecC1=str2num(get(handles.thresh_vecC,'String'));%threshold on image correlation vec_C
    2244     thresh_vel1=str2num(get(handles.thresh_vel,'String'));%threshold on velocity modulus
     2242    thresh_vecC1=str2double(get(handles.thresh_vecC,'String'));%threshold on image correlation vec_C
     2243    thresh_vel1=str2double(get(handles.thresh_vel,'String'));%threshold on velocity modulus
    22452244    test_mask=get(handles.get_mask_fix1,'Value');
    22462245    nbslice_mask=get(handles.mask_fix1,'UserData'); % get the number of slices (= number of masks)
     
    22622261%get patch1 parameters
    22632262if box_test(3)==1
    2264     rho_patch1=str2num(get(handles.rho_patch1,'String'));
    2265     if isempty(rho_patch1)
     2263    rho_patch1=str2double(get(handles.rho_patch1,'String'));
     2264    if isnan(rho_patch1)
    22662265        rho_patch1='1000';
    22672266        set(handles.rho_patch1,'String','1')
     
    22712270    nx_patch1=get(handles.nx_patch1,'String');
    22722271    ny_patch1=get(handles.ny_patch1,'String');
    2273     if isequal(str2num(nx_patch1),[])
     2272    if isnan(str2double(nx_patch1))
    22742273        nx_patch1='50' ;%default
    22752274        set(handles.nx_patch1,'String','50');
    22762275    end
    2277     if isequal(str2num(ny_patch1),[])
     2276    if isnan(str2double(ny_patch1))
    22782277        ny_patch1='50' ;%default
    22792278        set(handles.ny_patch1,'String','50');
     
    22932292    flagindex2(2)=get(handles.vec_F3_2, 'Value');
    22942293    flagindex2(3)=get(handles.vec_F4, 'Value');
    2295     thresh_vec2C=str2num(get(handles.thresh_vec2C,'String'));%threshold on image correlation vec_C
    2296     thresh_vel2=str2num(get(handles.thresh_vel2,'String'));%threshold on velocity modulus
     2294    thresh_vec2C=str2double(get(handles.thresh_vec2C,'String'));%threshold on image correlation vec_C
     2295    thresh_vel2=str2double(get(handles.thresh_vel2,'String'));%threshold on velocity modulus
    22972296    test_mask=get(handles.get_mask_fix2,'Value');
    22982297    nbslice_mask=get(handles.mask_fix2,'UserData'); % get the number of slices (= number of masks)
     
    23062305%get patch2 parameters
    23072306if box_test(6)==1
    2308     rho_patch2=str2num(get(handles.rho_patch2,'String'));
    2309     if isempty(rho_patch2)
     2307    rho_patch2=str2double(get(handles.rho_patch2,'String'));
     2308    if isnan(rho_patch2)
    23102309        rho_patch2='1000';
    23112310        set(handles.rho_patch2,'String','1')
     
    23152314    nx_patch2=get(handles.nx_patch2,'String');
    23162315    ny_patch2=get(handles.ny_patch2,'String');
    2317     if isequal(str2num(nx_patch2),[])
     2316    if isnan(str2double(nx_patch2))
    23182317        nx_patch2='50' ;%default
    23192318        set(handles.nx_patch2,'String','50');
    23202319    end
    2321     if isequal(str2num(ny_patch2),[])
     2320    if isnan(str2double(ny_patch2))
    23222321        ny_patch2='50' ;%default
    23232322        set(handles.ny_patch2,'String','50');
     
    23302329%MAIN LOOP
    23312330% for ifile=1:nbfield
    2332 p1text=[];%initiate command text
     2331% p1text=[];%initiate command text
    23332332time=get(handles.RootName,'UserData'); %get the set of times
    23342333civAll=get(handles.Experimental,'Value'); % Boolean for new civ excution method
     
    23502349        end
    23512350        filename_cmx=filecell.nc.civ1{ifile,j};%output netcdf file
    2352         filename_cmx(end-1:end)='cm';%name of cmx file
    2353         filename_cmx=[filename_cmx 'x'];
     2351        filename_cmx(end-1:end+1)='cmx';%name of cmx file
    23542352       
    23552353        %CIV1
     
    25132511        end
    25142512       
    2515         if box_test(4)==1 | box_test(5)==1 | box_test(6)==1
     2513        if box_test(4)==1 || box_test(5)==1 || box_test(6)==1
    25162514            filename_cmx=filecell.nc.civ2{ifile,j};%output netcdf file
    2517             filename_cmx([end-1:end])=[ 'cm'];%name of cmx file
    2518             filename_cmx=[filename_cmx 'x'];
     2515            filename_cmx([end-1:end+1])=[ 'cmx'];%name of cmx file
     2516%             filename_cmx=[filename_cmx 'x'];
    25192517        end
    25202518       
     
    27982796filebase_B=filebase;% root name of the second field series for stereo
    27992797if strcmp(compare,'displacement') || strcmp(compare,'stereo PIV')
    2800     test_disp=1;
     2798%     test_disp=1;
    28012799    nom_type_ima1=browse.nom_type_ima_1; %nomenclature type of the second file series
    28022800    [Path2,Name2]=fileparts(filebase_B);
     
    28122810    filebase_AB=fullfile(Path2,[Name2 '-' Name1]);
    28132811else
    2814     test_disp=0;
     2812%     test_disp=0;
    28152813    filebase_A=filebase;
    28162814    nom_type_ima1=nom_type_ima2;
     
    28412839        last_j=str2num(get(handles.last_j,'String'));
    28422840        incr_j=str2num(get(handles.incr_j,'String'));
    2843         num_i_ref=[first_i:incr_i:last_i];
    2844         num_j_ref=[first_j:incr_j:last_j];
     2841        num_i_ref=first_i:incr_i:last_i;
     2842        num_j_ref=first_j:incr_j:last_j;
    28452843        if isequal(mode,'displacement')
    28462844            num_i1=num_i_ref;
     
    28892887    ref=get(handles.ref_fix2,'UserData');
    28902888    if ~isempty(ref)
    2891         first_i=str2num(get(handles.first_i,'String'));
    2892         last_i=str2num(get(handles.last_i,'String'));
    2893         incr_i=str2num(get(handles.incr_i,'String'));
    2894         first_j=str2num(get(handles.first_j,'String'));
    2895         last_j=str2num(get(handles.last_j,'String'));
    2896         incr_j=str2num(get(handles.incr_j,'String'));
     2889        first_i=str2double(get(handles.first_i,'String'));
     2890        last_i=str2double(get(handles.last_i,'String'));
     2891        incr_i=str2double(get(handles.incr_i,'String'));
     2892        first_j=str2double(get(handles.first_j,'String'));
     2893        last_j=str2double(get(handles.last_j,'String'));
     2894        incr_j=str2double(get(handles.incr_j,'String'));
    28972895        num_i_ref=[first_i:incr_i:last_i];
    28982896        num_j_ref=[first_j:incr_j:last_j];
     
    29512949dircur=pwd; %current working directory
    29522950m2='';
    2953 [erread,message]=fileattrib(Path_ima);
     2951[xx,message]=fileattrib(Path_ima);
    29542952if ~isempty(message) && ~isequal(message.UserWrite,1)
    29552953    msgbox_uvmat('ERROR',['No writting access to ' Path_ima])
     
    29632961if box_test(1)==1;
    29642962    detect=1;
     2963    vers=0;
     2964    subdir_civ1_new=subdir_civ1;
    29652965    while detect==1 %create a new subdir if the netcdf files already exist
    2966         vers=0;
    2967         subdir_civ1_new=subdir_civ1;
    29682966        for ifile=1:nbfield
    29692967            for j=1:nbslice
     
    29712969                detect=exist(filename,'file')==2;
    29722970                if detect% if a netcdf file already exists
    2973                     vers=vers+1;
    2974                     subdir_civ1_new=[subdir_civ1 '_' num2str(vers)];
     2971                    indstr=regexp(subdir_civ1,'\D');
     2972                    if indstr(end)<length(subdir_civ1) %subdir_civ1 ends by a number
     2973                        vers=str2double(subdir_civ1(indstr(end)+1:end))+1;
     2974                        subdir_civ1_new=[subdir_civ1(1:indstr(end)) num2str(vers)];
     2975                    else
     2976                        vers=vers+1;
     2977                        subdir_civ1_new=[subdir_civ1(1:indstr(end)) '_' num2str(vers)];       
     2978                    end
    29752979                    subdir_civ2=subdir_civ1;
    29762980                    break
     
    29822986            end
    29832987        end
    2984         subdir_civ1=subdir_civ1_new;
    29852988        %create the new subdir_civ1
    2986         if ~exist(fullfile(Path_ima,subdir_civ1),'dir')
    2987             [m1,m2,m3]=mkdir(subdir_civ1);
     2989        if ~exist(fullfile(Path_ima,subdir_civ1_new),'dir')
     2990            [xx,m2]=mkdir(subdir_civ1_new);
    29882991            if ~isequal(m2,'')
    29892992                msgbox_uvmat('ERROR', m2)%error message for directory creation
     
    29942997        end
    29952998        if strcmp(compare,'stereo PIV')&&(strcmp(mode,'pair j1-j2')||strcmp(mode,'series(Dj)')||strcmp(mode,'series(Di)'))%check second nc series
    2996             vers=0;
    2997             subdir_civ1_new=subdir_civ1;
     2999%             vers=0;
     3000%             subdir_civ1_new=subdir_civ1;
    29983001            for ifile=1:nbfield
    29993002                for j=1:nbslice
     
    30013004                    detect=exist(filename,'file')==2;
    30023005                    if detect% if a netcdf file already exists
    3003                         vers=vers+1;
    3004                         subdir_civ1_new=[subdir_civ1 '_' num2str(vers)];
    3005                         subdir_civ2=subdir_civ1;
    3006                         break
     3006                       indstr=regexp(subdir_civ1,'\D');
     3007                       if indstr(end)<length(subdir_civ1) %subdir_civ1 ends by a number
     3008                           vers=str2double(subdir_civ1(indstr(end)+1:end))+1;
     3009                           subdir_civ1_new=[subdir_civ1(1:indstr(end)) num2str(vers)];
     3010                       else
     3011                           vers=vers+1;
     3012                           subdir_civ1_new=[subdir_civ1 '_' num2str(vers)];
     3013                       end
     3014                       subdir_civ2=subdir_civ1;
     3015                       break
    30073016                    end
    30083017                    filecell.ncA.civ1(ifile,j)={filename};
     
    30123021                end
    30133022            end
    3014             subdir_civ1=subdir_civ1_new;
     3023%             subdir_civ1=subdir_civ1_new;
    30153024            %create the new subdir_civ1
    3016             if ~exist(fullfile(Path_ima,subdir_civ1),'dir')
    3017                 [m1,m2,m3]=mkdir(subdir_civ1);
     3025            if ~exist(fullfile(Path_ima,subdir_civ1_new),'dir')
     3026                [xx,m2]=mkdir(subdir_civ1_new);
    30183027                if ~isequal(m2,'')
    30193028                    msgbox_uvmat('ERROR', m2)
     
    30253034        end
    30263035    end
     3036    subdir_civ1=subdir_civ1_new;
    30273037    % get image names
    30283038    for ifile=1:nbfield
     
    31143124testdiff=0;
    31153125if (box_test(4)==1)&&...
    3116         ((get(handles.list_pair_civ1,'Value')~=get(handles.list_pair_civ2,'Value'))||~isequal(subdir_civ2,subdir_civ1))
     3126        ((get(handles.list_pair_civ1,'Value')~=get(handles.list_pair_civ2,'Value'))||~strcmp(subdir_civ2,subdir_civ1))
    31173127    testdiff=1;
    31183128    detect=1;
     3129    vers=0;
     3130    subdir_civ2_new=subdir_civ2;
    31193131    while detect==1 %create a new subdir if the netcdf files already exist
    31203132        for ifile=1:nbfield
    31213133            for j=1:nbslice
    3122                 filename=name_generator(filebase_nc,num1_civ2(ifile),num_a_civ2(j),'.nc',nom_type_nc,1,num2_civ2(ifile),num_b_civ2(j),subdir_civ2);%
     3134                filename=name_generator(filebase_nc,num1_civ2(ifile),num_a_civ2(j),'.nc',nom_type_nc,1,num2_civ2(ifile),num_b_civ2(j),subdir_civ2_new);%
    31233135                detect=exist(filename,'file')==2;
    31243136                if detect% if a netcdf file already exists
    3125                     subdir_civ2=[subdir_civ2 '.0'];
     3137                    indstr=regexp(subdir_civ2,'\D');
     3138                    if indstr(end)<length(subdir_civ2) %subdir_civ1 ends by a number
     3139                        vers=str2double(subdir_civ2(indstr(end)+1:end))+1;
     3140                        subdir_civ2_new=[subdir_civ2(1:indstr(end)) num2str(vers)];
     3141                    else
     3142                        vers=vers+1;
     3143                        subdir_civ2_new=[subdir_civ1 '_' num2str(vers)];
     3144                    end
    31263145                    break
    31273146                end
     
    31343153        %create the new subdir_civ2
    31353154        if ~exist(fullfile(Path_ima,subdir_civ2),'dir')
    3136             [m1,m2,m3]=mkdir(subdir_civ2);
     3155            [xx,m2]=mkdir(subdir_civ2);
    31373156            if ~isequal(m2,'')
    31383157                msgbox_uvmat('ERROR', m2)
     
    31433162        end
    31443163        if strcmp(compare,'stereo PIV')%check second nc series
    3145             vers=0;
    3146             subdir_civ2_new=subdir_civ2;
    31473164            for ifile=1:nbfield
    31483165                for j=1:nbslice
     
    31513168                    detect=exist(filename,'file')==2;
    31523169                    if detect% if a netcdf file already exists
    3153                         vers=vers+1;
    3154                         subdir_civ2_new=[subdir_civ2 '_' num2str(vers)];
     3170                        indstr=regexp(subdir_civ2,'\D');
     3171                        if indstr(end)<length(subdir_civ2) %subdir_civ1 ends by a number
     3172                           vers=str2double(subdir_civ2(indstr(end)+1:end))+1;
     3173                           subdir_civ2_new=[subdir_civ2(1:indstr(end)) num2str(vers)];
     3174                        else
     3175                           vers=vers+1;
     3176                           subdir_civ2_new=[subdir_civ1 '_' num2str(vers)];
     3177                        end
    31553178                        break
    31563179                    end
     
    31633186            subdir_civ2=subdir_civ2_new;
    31643187            %create the new subdir_civ1
    3165             if ~exist(fullfile(Path_ima,subdir_civ2),'dir')
    3166                 [m1,m2,m3]=mkdir(subdir_civ2);
     3188            if ~exist(fullfile(Path_ima,subdir_civ2_new),'dir')
     3189                [xx,m2]=mkdir(subdir_civ2_new);
    31673190                if ~isequal(m2,'')
    31683191                    msgbox_uvmat('ERROR', m2)%error message for directory creation
     
    31743197        end
    31753198    end
     3199    subdir_civ2=subdir_civ2_new;
    31763200end
    31773201cd(currentdir);%come back to the current working directory
     
    33033327%%%%%%%%%%%%%  if stereo fields are calculated by PATCH %%%%%%%%%%%%%
    33043328if strcmp(compare,'stereo PIV')
    3305     if  box_test(3)==1 & isequal(get(handles.test_stereo1,'Value'),1)
     3329    if  box_test(3)==1 && isequal(get(handles.test_stereo1,'Value'),1)
    33063330        for ifile=1:nbfield
    33073331            for j=1:nbslice
     
    33123336        end
    33133337    end
    3314     if  box_test(6)==1 & isequal(get(handles.test_stereo2,'Value'),1)
     3338    if  box_test(6)==1 && isequal(get(handles.test_stereo2,'Value'),1)
    33153339        for ifile=1:nbfield
    33163340            for j=1:nbslice
     
    34343458end
    34353459
    3436 %------------------------------------------------------------------------
    3437 %CIV1  CIV1  CIV1 CIV1 NOT USED: replaced by RUN_BATCH
    3438 function RUN_CIV1(handles,filecell,filecell_1,filecell_nc1,num1,num2,num_a,num_b,nom_type_nc)
    3439 %------------------------------------------------------------------------
    3440 %pixels per cm and matrix of the image times, read from the .civ file by uvmat
    3441 global civ1Bin sge%name of the executable for civ1 calculation
    3442 
    3443 %get civ parameters
    3444 ibx_val=str2num(get(handles.ibx,'String'));
    3445 if isempty(ibx_val)
    3446     ibx='21'; set(handles.ibx,'String','21')
    3447 else
    3448     ibx=num2str(ibx_val);
    3449 end
    3450 iby_val=str2num(get(handles.iby,'String'));
    3451 if isempty(iby_val)
    3452     iby='21'; set(handles.iby,'String','21')
    3453 else
    3454     iby=num2str(iby_val);
    3455 end
    3456 isx=get(handles.isx,'String');
    3457 if isempty(str2num(isx)), isx='41'; set(handles.isx,'String','41'), end; %default
    3458 if str2num(isx)<ibx_val+8,isx=num2str(ibx_val+8); set(handles.isx,'String',num2str(ibx_val+8)); end
    3459 isy=get(handles.isy,'String');
    3460 if isempty(str2num(isy)), isy='41'; set(handles.isy,'String','41'), end;%default
    3461 if str2num(isy)<iby_val+8,isy=num2str(iby_val+8); set(handles.isy,'String',num2str(iby_val+8)); end
    3462 shiftx=get(handles.shiftx,'String');
    3463 if isempty(str2num(shiftx)), shiftx='0'; set(handles.shiftx,'String','0'), end;%default
    3464 shifty=get(handles.shifty,'String');
    3465 if isempty(str2num(shifty)), shifty='0'; set(handles.shifty,'String','0'), end;%default
    3466 rho=get(handles.rho,'String');
    3467 dx=get(handles.dx_civ1,'String');
    3468 if isequal(str2num(dx),[]), dx='20'; set(handles.dx_civ1,'String','20'); end%default
    3469 dy=get(handles.dy_civ1,'String');
    3470 if isequal(str2num(dy),[]), dy='20'; set(handles.dy_civ1,'String','20');end %default
    3471 if isequal(str2num(dy),[]), dy='20'; end%default
    3472 pxcmx='1'; %velocity fields are expressed in pixel displacement
    3473 pxcmy='1';
    3474 image_first=cell2mat(filecell(1,1));
    3475 if ~exist(image_first,'file')
    3476     msgbox_uvmat('ERROR',['image ' image_first 'not found'])
    3477     set(handles.RUN, 'Enable','On')
    3478     set(handles.RUN,'BackgroundColor',[1 0 0])
    3479     return
    3480 end
    3481 A=imread(cell2mat(filecell(1,1)));%read the first image to get the size
    3482 sizim=size(A);
    3483 npx=num2str(sizim(2));
    3484 npy=num2str(sizim(1));
    3485 time=get(handles.RootName,'UserData'); %get the set of times
    3486 gridname='';%default  ='noFile use default'
    3487 gridflag='n';%default
    3488 test_grid=get(handles.browse_gridciv1,'Value');
    3489 nbslice_grid=[];
    3490 if test_grid
    3491     gridname=get(handles.grid_civ1,'String');
    3492     if numel(gridname)>4 && isequal(gridname(end-3:end),'grid')
    3493         nbslice_grid=str2num(gridname(1:end-4)); %
    3494         if ~isempty(nbslice_grid)
    3495             gridflag='y';
    3496         end
    3497     elseif exist(gridname,'file')
    3498         gridflag='y';
    3499     else
    3500         msgbox_uvmat('ERROR',['input grid file ' gridname ' not found'])
    3501         return
    3502     end
    3503 end
    3504 if isequal(get(handles.ImaThreshold,'Value'),1)
    3505     threshflag='y';
    3506     min_ima=get(handles.MinIma,'String');
    3507     max_ima=get(handles.MaxIma,'String');
    3508 else
    3509     threshflag='n';
    3510     min_ima='0';
    3511     max_ima='4096';
    3512 end
    3513 %main loop
    3514 filebase=get(handles.RootName,'String');
    3515 sizcell=size(filecell);
    3516 nbfield=sizcell(1);
    3517 nbslice=sizcell(2);
    3518 icount=0;
    3519 for ifile=1:nbfield
    3520     for j=1:nbslice
    3521         icount=icount+1;
    3522         barlength=0.188*icount/(nbfield*nbslice);
    3523         set(handles.waitbar_1,'Position',[0.946 0.877-barlength 0.03 barlength])
    3524         drawnow
    3525         filename_ima=cell2mat(filecell(ifile,j));
    3526         filename_ima([end-3:end])=[];%remove .png extension
    3527         filename_ima_1=cell2mat(filecell_1(ifile,j));
    3528         filename_ima_1([end-3:end])=[];%remove .png extension
    3529         filename_cmx=cell2mat(filecell_nc1(ifile,j));%output netcdf file
    3530         filename_cmx([end-1:end])=[ 'cm'];%name of cmx file
    3531         filename_cmx=[filename_cmx 'x'];
    3532         namelog=[filename_cmx([1:end-3]) 'log'];
    3533         if size(time,1)>=num2(ifile) &  size(time,2)>=num_b(j)
    3534             Dt=num2str(time(num2(ifile),num_b(j))-time(num1(ifile),num_a(j)));
    3535             if isequal(Dt,'0')
    3536                 Dt='1' ;%case of 'displacement' mode
    3537             end
    3538             T0=num2str((time(num2(ifile),num_b(j))+time(num1(ifile),num_a(j)))/2);
    3539         else
    3540             Dt='1';
    3541             T0='0';
    3542         end
    3543         term_a=num2stra(num_a(j),nom_type_nc);%UTILITE?
    3544         term_b=num2stra(num_b(j),nom_type_nc);%
    3545         if test_grid && ~isempty(nbslice_grid)
    3546             num1_grid=mod(num1(ifile)-1,nbslice_grid)+1;
    3547             gridname=[filebase '_' name_generator(gridname,num1_grid,1,'.grid','_i')];
    3548             if ~exist(gridname,'file')
    3549                 msgbox_uvmat('ERROR',['missing grid file ' gridname])
    3550                 return
    3551             end
    3552         end
    3553         test_mask=get(handles.get_mask_civ1,'Value');
    3554         if test_mask==0
    3555             maskname='noFile use default';
    3556             maskflag='n';
    3557         else
    3558             maskdispl=get(handles.mask_civ1,'String');%look for mask name in edit box
    3559             maskbase=[filebase '_' maskdispl];%
    3560             nbslice=str2num(maskdispl(1:end-4)); %
    3561             num1_mask=mod(num1(ifile)-1,nbslice)+1;
    3562             maskname=name_generator(maskbase,num1_mask,1,'.png','_i');
    3563             if exist(maskname,'file')
    3564                 maskflag='y';
    3565             else
    3566                 maskname='noFile use default';
    3567                 maskflag='n';
    3568             end
    3569         end
    3570         textcmx={'##############   CMX file';...
    3571             ['FirstImage ' filename_ima];...
    3572             ['LastImage  ' filename_ima_1];...
    3573             'XX' ;...
    3574             ['Mask ' maskflag] ;...
    3575             ['MaskName ' maskname];...
    3576             ['ImageSize ' npx ' ' npy];...   %VERIFIER CAS GENERAL ?
    3577             ['CorrelationBoxesSize ' ibx ' ' iby];...
    3578             ['SearchBoxeSize ' isx ' ' isy];...
    3579             ['RO ' rho];...
    3580             ['GridSpacing ' dx ' ' dy];...
    3581             'XX 1.0';...
    3582             ['Dt_TO ' Dt ' ' T0];...
    3583             ['PixCmXY ' pxcmx ' ' pxcmy];...
    3584             'XX 1';...
    3585             ['ShiftXY ' shiftx ' ' shifty];...
    3586             ['Grid ' gridflag];...
    3587             ['GridName ' gridname] ;...
    3588             'XX 85';...
    3589             'XX 1.0';...
    3590             'XX 1.0';...
    3591             'Hart 1';...
    3592             'DecimalShift 0';...
    3593             'Deformation 0';...
    3594             'CorrelationMin 0';...
    3595             'IntensityMin 0';...
    3596             ['SeuilImage ' threshflag];...
    3597             ['SeuilImageValues ' min_ima ' ' max_ima];...
    3598             ['ImageToUse ' term_a ' ' term_b];... % VERIFIER ?
    3599             'ImageUsedBefore null null'};
    3600         textout=char(textcmx);
    3601         %               dlmwrite(filename_cmx,textout,'');
    3602         fid=fopen([filename_cmx],'w');
    3603         fprintf(fid, ['##############   CMX file' '\n']);
    3604         fprintf(fid,   ['FirstImage ' regexprep(filename_ima,'\\','\\\\') '\n' ]);
    3605         fprintf(fid,   ['LastImage  ' regexprep(filename_ima_1,'\\','\\\\') '\n' ]);
    3606         fprintf(fid,  ['XX' '\n' ]);
    3607         fprintf(fid,  ['Mask '  maskflag '\n' ]);
    3608         fprintf(fid,  ['MaskName '  maskname '\n' ]);
    3609         fprintf(fid,   ['ImageSize '  npx ' '  npy '\n' ]);   %VERIFIER CAS GENERAL ?
    3610         fprintf(fid,   ['CorrelationBoxesSize '  ibx ' '  iby '\n' ]);
    3611         fprintf(fid,   ['SearchBoxeSize '  isx ' '  isy '\n' ]);
    3612         fprintf(fid,   ['RO '  rho '\n' ]);
    3613         fprintf(fid,   ['GridSpacing '  dx ' '  dy '\n' ]);
    3614         fprintf(fid,   ['XX 1.0' '\n' ]);
    3615         fprintf(fid,   ['Dt_TO '  Dt ' '  T0 '\n' ]);
    3616         fprintf(fid,  ['PixCmXY '  pxcmx ' '  pxcmy '\n' ]);
    3617         fprintf(fid,  ['XX 1' '\n' ]);
    3618         fprintf(fid,   ['ShiftXY '  shiftx ' '   shifty '\n' ]);
    3619         fprintf(fid,  ['Grid '  gridflag '\n' ]);
    3620         fprintf(fid,   ['GridName '  gridname '\n' ]);
    3621         fprintf(fid,   ['XX 85' '\n' ]);
    3622         fprintf(fid,   ['XX 1.0' '\n' ]);
    3623         fprintf(fid,   ['XX 1.0' '\n' ]);
    3624         fprintf(fid,   ['Hart 1' '\n' ]);
    3625         fprintf(fid,  [ 'DecimalShift 0' '\n' ]);
    3626         fprintf(fid,   ['Deformation 0' '\n' ]);
    3627         fprintf(fid,  ['CorrelationMin 0' '\n' ]);
    3628         fprintf(fid,   ['IntensityMin 0' '\n' ]);
    3629         fprintf(fid,  ['SeuilImage n' '\n' ]);
    3630         fprintf(fid,   ['SeuilImageValues 0 4096' '\n' ]);
    3631         fprintf(fid,   ['ImageToUse '  term_a ' '  term_b '\n' ]); % VERIFIER ?
    3632         fprintf(fid,   ['ImageUsedBefore null null' '\n' ]);
    3633         fclose(fid);
    3634        
    3635         s=-1;
    3636         display(['!' civ1Bin ' -f ' filename_cmx ' > ' namelog ])
    3637         eval(['!' civ1Bin ' -f ' filename_cmx ' > ' namelog ]);
    3638         %               if sge%dispatch computation on the cluster using interactive queue
    3639         %           %  [s,w] = unix(['qrsh -q fast.q ' civ1Bin ' -f ' filename_cmx ' > ' namelog ' 2>&1' ]);
    3640         %        end
    3641         %         if s~=0
    3642         %            %  ['!' civ1Bin ' -f ' filename_cmx ' > ' namelog]
    3643         %            % eval(['!' civ1Bin ' -f ' filename_cmx ' > ' namelog]);
    3644         %         end
    3645     end
    3646 end
    3647 
    3648 % %------------------------------------------------------------------------
    3649 % % RUN CIV2   CIV2    CIV2   CIV2
    3650 % function RUN_CIV2(handles,filecell_2,filecell_3,filecell_nc1,filecell_nc2,num1,num2,num_a,num_b,nom_type_nc)
    3651 % %------------------------------------------------------------------------
    3652 % %filecell_2: names of first image
    3653 % %filecell_3: names of second images
    3654 % global civ2Bin sge
    3655 %
    3656 % %names of the civ2 fields
    3657 % field.vel_type='civ2';
    3658 % field.nb='nb_vectors2';
    3659 % field.X='vec2_X';
    3660 % field.Y='vec2_Y';
    3661 % field.U='vec2_U';
    3662 % field.V='vec2_V';
    3663 %
    3664 % %get civ parameters
    3665 % ibx=get(handles.ibx_civ2,'String');
    3666 % iby=get(handles.iby_civ2,'String');
    3667 % rho=get(handles.rho_civ2,'String');
    3668 % decimal=int2str(get(handles.decimal,'Value'));
    3669 % deformation=int2str(get(handles.deformation,'Value'));
    3670 % dx=get(handles.dx_civ2,'String');
    3671 % dy=get(handles.dy_civ2,'String');
    3672 % if isequal(str2num(dx),[])
    3673 %     dx='20';%default
    3674 % end
    3675 % if isequal(str2num(dy),[])
    3676 %     dy='20';%default
    3677 % end
    3678 %     pxcmx='1';%velocity fields are expressed in pixel displacement
    3679 %     pxcmy='1';
    3680 % A=imread(cell2mat(filecell_2(1,1)));%read the first image to get the size
    3681 % sizim=size(A);
    3682 % npx=num2str(sizim(2));
    3683 % npy=num2str(sizim(1));
    3684 % time=get(handles.RootName,'UserData'); %get the set of times
    3685 % filebase=get(handles.RootName,'String');
    3686 % %grid
    3687 % gridname='';%default  ='noFile use default'
    3688 % gridflag='n';%default
    3689 % test_grid=get(handles.browse_gridciv2,'Value');
    3690 % nbslice_grid=[];
    3691 % if test_grid
    3692 %     gridname=get(handles.grid_civ2,'String');
    3693 %     if numel(gridname)>4 && isequal(gridname(end-3:end),'grid')
    3694 %         nbslice_grid=str2num(gridname(1:end-4)); %
    3695 %         if ~isempty(nbslice_grid)
    3696 %             gridflag='y';
    3697 %         end
    3698 %     elseif exist(gridname,'file')
    3699 %         gridflag='y';
    3700 %     else
    3701 %         msgbox_uvmat('ERROR',['input grid file ' gridname ' not found'])
    3702 %         return
    3703 %     end
    3704 % end
    3705 % sizcell=size(filecell_2);
    3706 % nbfield=sizcell(1);
    3707 % nbslice=sizcell(2);
    3708 %
    3709 % %main loop
    3710 % icount=0;
    3711 % for ifile=1:nbfield
    3712 %     for j=1:nbslice
    3713 %         icount=icount+1;
    3714 %         barlength=0.188*icount/(nbfield*nbslice);
    3715 %         set(handles.waitbar_civ2,'Position',[0.946 0.407-barlength 0.03 barlength])
    3716 %         drawnow
    3717 %         filename_ima_2=cell2mat(filecell_2(ifile,j));
    3718 %         filename_ima_2([end-3:end])=[];%remove .png extension
    3719 %         filename_ima_3=cell2mat(filecell_3(ifile,j));
    3720 %         filename_ima_3([end-3:end])=[];%remove .png extension
    3721 %         filename_cmx=cell2mat(filecell_nc2(ifile,j));%output netcdf file
    3722 %         filename_cmx([end-1:end])=[ 'cm'];%name of cmx file
    3723 %         filename_cmx=[filename_cmx 'x'];
    3724 %         namelog=[filename_cmx([1:end-3]) 'log'];
    3725 %         if size(time,1)>=num2(ifile) &  size(time,2)>=num_b(j)
    3726 %             Dt=num2str(time(num2(ifile),num_b(j))-time(num1(ifile),num_a(j)));
    3727 %             if isequal(Dt,'0')
    3728 %                 Dt='1' ;%case of 'displacement' mode
    3729 %             end
    3730 %             T0=num2str((time(num2(ifile),num_b(j))+time(num1(ifile),num_a(j)))/2);
    3731 %         else
    3732 %             Dt='1';
    3733 %             T0='0';
    3734 %         end
    3735 %         term_a=num2stra(num_a(j),nom_type_nc);
    3736 %         term_b=num2stra(num_b(j),nom_type_nc);
    3737 %         filename_nc1=cell2mat(filecell_nc1(ifile,j));
    3738 %         filename_nc1([end-2:end])=[]; % remove '.nc'
    3739 %         if test_grid && ~isempty(nbslice_grid)
    3740 %             num1_grid=mod(num1(ifile)-1,nbslice_grid)+1;
    3741 %             gridname=[filebase '_' name_generator(gridname,num1_grid,1,'.grid','_i')];
    3742 %             if ~exist(gridname,'file')
    3743 %                 msgbox_uvmat('ERROR',['missing grid file ' gridname])
    3744 %                 return
    3745 %             end
    3746 %         end
    3747 %         test_mask=get(handles.get_mask_civ2,'Value');
    3748 %         if test_mask==0
    3749 %             maskname='noFile use default';
    3750 %             maskflag='n';
    3751 %         else
    3752 %             maskdispl=get(handles.mask_civ2,'String');
    3753 %             maskbase=[filebase '_' maskdispl]; %
    3754 %             nbslice_mask=str2num(maskdispl(1:end-4)); %
    3755 %             num1_mask=mod(num1(ifile)-1,nbslice_mask)+1;
    3756 %             maskname =name_generator(maskbase,num1_mask,1,'.png','_i');
    3757 %             if ~exist(maskname,'file')
    3758 %                 maskflag='y';
    3759 %             else
    3760 %                 maskname='noFile use default';
    3761 %                 maskflag='n';
    3762 %             end
    3763 %         end
    3764 %
    3765 %               textcmx={'##############   CMX file';...
    3766 %               ['FirstImage ' filename_ima_2];...
    3767 %               ['LastImage  ' filename_ima_3];...
    3768 %               'XX' ;...
    3769 %               ['Mask ' maskflag];...
    3770 %               ['MaskName ' maskname];...
    3771 %               ['ImageSize ' npx ' ' npy];...
    3772 %               ['CorrelationBoxesSize ' ibx ' ' iby];...
    3773 %               ['SearchBoxeSize ' ibx ' ' iby];...
    3774 %               ['RO ' rho];...
    3775 %               ['GridSpacing ' dx ' ' dy];...
    3776 %               'XX 1.0';...
    3777 %               ['Dt_TO ' Dt ' ' T0];...
    3778 %               ['PixCmXY ' pxcmx ' ' pxcmy];...
    3779 %               'XX 1';...
    3780 %               ['ShiftXY 0 0'];...
    3781 %               ['Grid ' gridflag];...
    3782 %               ['GridName ' gridname];...
    3783 %               'XX 85';...
    3784 %               'XX 1.0';...
    3785 %               'XX 1.0';...
    3786 %               'Hart 1';...
    3787 %               ['DecimalShift ' decimal];...
    3788 %               ['Deformation ' deformation];...
    3789 %               'CorrelationMin 0';...
    3790 %               'IntensityMin 0';...
    3791 %               'SeuilImage n';...
    3792 %               'SeuilImageValues 0 4096';...
    3793 %               ['ImageToUse ' term_a ' ' term_b];... % VERIFIER ?
    3794 %               ['ImageUsedBefore ' filename_nc1]};
    3795 %         textout=char(textcmx);
    3796 %         dlmwrite(filename_cmx,textout,'');
    3797 %         s=-1;
    3798 %         display(['!' civ2Bin ' -f ' filename_cmx ' > ' namelog ])
    3799 %         eval(['!' civ2Bin ' -f ' filename_cmx ' > ' namelog ]);
    3800 %
    3801 % %             if sge%dispatch computation on the cluster using interactive queue
    3802 % %             [s,w] = unix(['qrsh -q fast.q ' civ2Bin ' -f ' filename_cmx ' > ' namelog ' 2>&1']);
    3803 % %         end
    3804 % %         if s~=0
    3805 % %             eval(['!' civ2Bin ' -f ' filename_cmx ' > ' namelog]);
    3806 % %             ['!' civ2Bin ' -f ' filename_cmx ' > ' namelog]
    3807 % %         end
    3808 %     end
    3809 % end
    3810 % % close(h)
    38113460
    38123461%------------------------------------------------------------------------
     
    47214370function par=read_param_civ1(handles,file_ima)
    47224371%------------------------------------------------------------------------
    4723 ibx_val=str2num(get(handles.ibx,'String'));
     4372ibx_val=str2double(get(handles.ibx,'String'));
    47244373par.ibx=num2str(ibx_val);
    4725 iby_val=str2num(get(handles.iby,'String'));
     4374iby_val=str2double(get(handles.iby,'String'));
    47264375par.iby=num2str(iby_val);
    47274376isx=get(handles.isx,'String');
    4728 if isempty(str2num(isx)), isx='41'; set(handles.isx,'String','41'), end; %default
    4729 if str2num(isx)<ibx_val+8,isx=num2str(ibx_val+8); set(handles.isx,'String',num2str(ibx_val+8)); end
     4377if isnan(str2double(isx)), isx='41'; set(handles.isx,'String','41'), end; %default
     4378if str2double(isx)<ibx_val+8,isx=num2str(ibx_val+8); set(handles.isx,'String',num2str(ibx_val+8)); end
    47304379isy=get(handles.isy,'String');
    4731 if isempty(str2num(isy)), isy='41'; set(handles.isy,'String','41'), end;%default
    4732 if str2num(isy)<iby_val+8,isy=num2str(iby_val+8); set(handles.isy,'String',num2str(iby_val+8)); end
     4380if isnan(str2double(isy)), isy='41'; set(handles.isy,'String','41'), end;%default
     4381if str2double(isy)<iby_val+8,isy=num2str(iby_val+8); set(handles.isy,'String',num2str(iby_val+8)); end
    47334382par.isx=get(handles.isx,'String');
    47344383par.isy=get(handles.isy,'String');
    47354384par.shiftx=get(handles.shiftx,'String');
    47364385par.shifty=get(handles.shifty,'String');
    4737 if isempty(str2num(par.isx))
     4386if isnan(str2double(par.isx))
    47384387    par.isx='41';%default
    47394388    set(handles.isx,'String','41');
    47404389end
    4741 if isempty(str2num(par.isy))
     4390if isnan(str2double(par.isy))
    47424391    par.isy='41'; %default
    47434392    set(handles.isy,'String','41');
    47444393end
    4745 if isempty(str2num(par.shiftx))
     4394if isnan(str2double(par.shiftx))
    47464395    par.shiftx='0';%default
    47474396    set(handles.shiftx,'String','0');
    47484397end
    4749 if isempty(str2num(par.shifty))
     4398if isnan(str2double(par.shifty))
    47504399    par.shifty='0'; %default
    47514400    set(handles.shifty,'String','0');
     
    47544403par.dx=get(handles.dx_civ1,'String');
    47554404par.dy=get(handles.dy_civ1,'String');
    4756 if isequal(str2num(par.dx),[])
     4405if isnan(str2double(par.dx))
    47574406    if isempty(get(handles.grid_civ1,'String'));
    47584407        par.dx='0'; %just read by civ program, not used
     
    47624411    end
    47634412end
    4764 if isequal(str2num(par.dy),[])
     4413if isnan(str2double(par.dy))
    47654414    if isempty(get(handles.grid_civ1,'String'));
    47664415        par.dy='0';%just read by civ program, not used
     
    47774426par.npx=num2str(sizim(2));
    47784427par.npy=num2str(sizim(1));
    4779 time=get(handles.RootName,'UserData'); %get the set of times
     4428%time=get(handles.RootName,'UserData'); %get the set of times
    47804429par.gridname=get(handles.grid_civ1,'String');
    47814430par.gridflag='y';
    4782 if isequal(par.gridname,'')| isempty(par.gridname)
     4431if strcmp(par.gridname,'')|| isempty(par.gridname)
    47834432    par.gridname='nogrid';
    47844433    par.gridflag='n';
     
    47954444par.dx=get(handles.dx_civ2,'String');
    47964445par.dy=get(handles.dy_civ2,'String');
    4797 if isequal(str2num(par.dx),[])
     4446if isnan(str2double(par.dx))
    47984447    if isempty(get(handles.grid_civ2,'String'));
    47994448        par.dx='0'; %just read by civ program, not used
     
    48034452    end
    48044453end
    4805 if isequal(str2num(par.dy),[])
     4454if isnan(str2double(par.dy))
    48064455    if isempty(get(handles.grid_civ2,'String'));
    48074456        par.dy='0';%just read by civ program, not used
     
    48174466par.npx=num2str(sizim(2));
    48184467par.npy=num2str(sizim(1));
    4819 time=get(handles.RootName,'UserData'); %get the set of times
     4468%time=get(handles.RootName,'UserData'); %get the set of times
    48204469par.gridname=get(handles.grid_civ2,'String');
    48214470par.gridflag='y';
    4822 if isequal(par.gridname,'')| isempty(par.gridname)
     4471if strcmp(par.gridname,'')|| isempty(par.gridname)
    48234472    par.gridname='nogrid';
    48244473    par.gridflag='n';
  • trunk/src/dataview.m

    r89 r127  
    113113% Get default command line output from handles structure
    114114varargout{1} = handles.output;
    115 delete(handles.figure)
     115%delete(handles.figure)
    116116
    117117%------------------------------------------------------------------------
  • trunk/src/name_generator.m

    r122 r127  
    5151end
    5252if ~ischar(ext),ext='';end
    53 idetect=0;
     53% idetect=0;
    5454if ~exist('num_i1','var') || isempty(num_i1) || isnan(num_i1)
    5555    num_i1=1; %default
     
    8282end
    8383if ~test_pairs%case of a single index i, and possibly j
    84     numlength=numel(nom_type);
     84%     numlength=numel(nom_type);
     85    nom_type_mod=nom_type;
    8586    num_j_str='';
    8687    if strcmp(nom_type(1),'_')
    8788        filename=[filename '_'];
    88         nom_type(1)=[];
    89     end
    90     if strcmp(nom_type(end),'a')
    91         nom_type(end)=[];
     89        nom_type_mod(1)=[];
     90    end
     91    if strcmp(nom_type_mod(end),'a')
     92        nom_type_mod(end)=[];
    9293        num_j_str=char(num_j1+96);% lower letter corresponding to the index
    93     elseif strcmp(nom_type(end),'A')
     94    elseif strcmp(nom_type_mod(end),'A')
    9495        nom_type(end)=[];
    9596        num_j_str=char(num_j1+64);% lower letter corresponding to the index
    96     elseif isequal(numel(regexp(nom_type(2:end),'_')),1)%if a separator '_' exists in nom_type
     97    elseif isequal(numel(regexp(nom_type_mod,'_')),1)%if a second separator '_' exists in nom_type
    9798        num_j_str=['_' num2str(num_j1)];
    98         nom_type(regexp(nom_type(2:end),'_'):end)=[];
     99        nom_type_mod(regexp(nom_type_mod,'_'):end)=[];
    99100    else
    100101        num_j1_out=[];%no index j
    101102    end
    102     if ~isempty(str2num(nom_type))   
    103         numtype=['%0' num2str(length(nom_type)) 'd'];%indicate the number of digits (0 before the number)
     103    if ~isnan(str2double(nom_type_mod))   
     104        numtype=['%0' num2str(length(nom_type_mod)) 'd'];%indicate the number of digits (0 before the number)
    104105        filename=[filename num2str(num_i1,numtype) num_j_str ext];
    105106        num_i2_out=num_i1_out;
     
    109110        filename=[filename ext];
    110111    end
    111 %     if  strcmp(nom_type,'_i');
    112 %         filename=[filebase '_' num2str(num_i1) ext];
    113 %         num_i2_out=num_i1;
    114 %         num_j1_out=[];
    115 %         num_j2_out=[];
    116 %     elseif length(nom_type)==5 && strcmp(nom_type(1:3),'_%0')&& strcmp(nom_type(5),'d');
    117 %         filename=[filebase '_' num2str(num_i1,nom_type(2:5)) ext];
    118 %         num_i2_out=num_i1;
    119 %         num_j2_out=num_j1;
    120 %     elseif  strcmp(nom_type,'_i_j')
    121 %         filename=[filebase '_' num2str(num_i1) '_' num2str(num_j1) ext];
    122 %         num_i2_out=num_i1;
    123 %         num_j2_out=num_j1;
    124 %     elseif  strcmp(nom_type,'#a')| strcmp(nom_type,'#A')
    125 %         filename=[filebase num2str(num_i1,'%03d') num2stra(num_j1,nom_type) ext];
    126 %         num_i2_out=num_i1;
    127 %         num_j2_out=num_j1;
    128 %     elseif  length(nom_type)>=5 & strcmp(nom_type(2:3),'%0') & strcmp(nom_type(5),'d')  %strcmp(nom_type,'_%04dA') %camera PCO Toulouse
    129 %         filename=[filebase nom_type(1) num2str(num_i1,nom_type(2:4)) num2stra(num_j1,nom_type) ext];
    130 %         num_i2_out=num_i1;
    131 %         num_j2_out=num_j1;
    132 %     elseif  strcmp(nom_type,'#')
    133 %         filename=[filebase num2str(num_i1) ext];
    134 %         num_i2_out=num_i1;
    135 %         num_j1_out=[];
    136 %         num_j2_out=[];
    137 %     elseif length(nom_type)>=4 & strcmp(nom_type(1:2),'%0') & strcmp(nom_type(end),'d')
    138 %         filename=[filebase num2str(num_i1,nom_type) ext]; %test number with a 0 before
    139 %         num_i2_out=num_i1;
    140 %         num_j1_out=[];
    141 %         num_j2_out=[];
    142 %     elseif length(nom_type)>=4 & strcmp(nom_type(1:2),'%0') & strcmp(nom_type(end-1:end),'dA')
    143 %         filename=[filebase num2str(num_i1,nom_type(1:end-1)) num2stra(num_j1,'#A') ext]; %test number with a 0 before
    144 %         num_i2_out=num_i1;
    145 %         num_j1_out=[];
    146 %         num_j2_out=[];
    147 %     end
     112
    148113%case of derived file indexing (e.g. netcdf files)
    149114else
    150      %inexistant pair if num_i2=0 or num_j2=0
    151 %     if strcmp(num_i2,0)
    152 %         filename=[filebasesub '*-*_' num2str(num_i1) ext];
    153 %         return
    154 %     end
    155 %     if strcmp(num_j2,0)
    156 %         filename=[filebasesub '_' num2str(num_i1) '_*-*' ext];
    157 %         return
    158 %     end
    159115    % case of an imposed image pair (comp_input=1)
    160116    if  (exist('comp_input','var') && isequal(comp_input,1))
     
    205161            elseif isequal(nom_type,'i1-i2_j1-j2')
    206162                if isequal(num2str(num_i1),num2str(num_i2))% case of displacements at the same time
    207                     app1= [num2str(num_i1)];
     163                    app1= num2str(num_i1);
    208164                else
    209165                    app1= [num2str(num_i1) '-' num2str(num_i2)];
    210166                end
    211167                if isequal(num2str(num_j1),num2str(num_j2))% case of displacements at the same time
    212                     app2= [num2str(num_j1)];
     168                    app2= num2str(num_j1);
    213169                else
    214170                    app2= [num2str(num_j1) '-' num2str(num_j2)];
     
    228184        direct=dir(pathfile);%directory containing filebase
    229185        datedir=[];%default
    230         idir=0;
     186%         idir=0;
    231187        indir=find(cell2mat({direct.isdir}));% find indices of subdirectories
    232         direct=direct(indir([3:end]));% keep only the subdirectories,eliminating the two first terms '.' and '..'
     188        direct=direct(indir(3:end));% keep only the subdirectories,eliminating the two first terms '.' and '..'
    233189        lengthdir=length(direct);
    234190        if lengthdir==0
     
    240196                char_code=double(date_str);% code of the date characters
    241197                special_char=(char_code>127); %non standard Ascii character (e.g. date in french)
    242                 if isempty(find(special_char))% standard Ascii character
     198                if isempty(find(special_char,1))% standard Ascii character
    243199                    datedir(idir)=datenum(date_str);
    244200                end                           
     
    250206        filebasesub=fullfile(pathfile,subdir,name);
    251207        %if the image pair is imposed
    252         if (exist('comp_input','var') & isequal(comp_input,1))
    253             if isequal(nom_type,'netc_old')|isequal(nom_type,'#_ab')
     208        if (exist('comp_input','var') && isequal(comp_input,1))
     209            if isequal(nom_type,'#_ab')
    254210                filename=[filebasesub num2str(num_i1,'%03d') '_' num2stra(num_j1,nom_type) num2stra(num_j2,nom_type) ext];
    255             elseif isequal(nom_type,'netc_2D')|isequal(nom_type,'_i1_j1-j2')
     211            elseif isequal(nom_type,'_i1_j1-j2')
    256212                filename=[filebasesub '_' num2str(num_i1) '_' num2str(num_j1) '-' num2str(num_i2) ext];
    257             elseif isequal(nom_type,'netc_3D')|isequal(nom_type,'_i1-i2_j')
     213            elseif isequal(nom_type,'_i1-i2_j')
    258214                filename=[filebasesub '_' num2str(num_i1) '-' num2str(num_i2) '_' num2str(num_j1) ext];
    259             elseif isequal(nom_type,'netc_series')|isequal(nom_type,'_i1-i2')
     215            elseif isequal(nom_type,'_i1-i2')
    260216                filename=[filebasesub '_' num2str(num_i1) '-' num2str(num_i2) ext];
    261217            end
    262             idetect=(exist(filename,'file')==2);
     218%             idetect=(exist(filename,'file')==2);
    263219        else
    264             [filename,num_i1_out,num_j1_out,num_i2_out,num_j2_out,idetect]=search_pair(filebasesub,num_i1,num_j1,num_i2,nom_type);             
     220            [filename,num_i1_out,num_j1_out,num_i2_out,num_j2_out]=search_pair(filebasesub,num_i1,num_j1,num_i2,nom_type);             
    265221        end
    266222    end
    267223end
    268 if ~isequal(subdir,'?'), subdir_out=subdir; else, subdir_out='';end;
     224if ~strcmp(subdir,'?')
     225    subdir_out=subdir;
     226else
     227    subdir_out='';
     228end
    269229
    270230%------------------------------------------------------------------------
     
    278238
    279239filename=[];num_j2=[];idetect=0;%default values
    280 if isequal(nom_type,'netc_old')|isequal(nom_type,'#_ab')
     240if isequal(nom_type,'#_ab')
    281241    dirpair=dir([filebasesub num2str(num_i1,'%03d') '_*.nc']);
    282 elseif isequal(nom_type,'netc_2D')|isequal(nom_type,'_i_j1-j2')
     242elseif isequal(nom_type,'_i_j1-j2')
    283243    dirpair=dir([filebasesub '_' num2str(num_i1) '_*-*.nc']);
    284 elseif isequal(nom_type,'netc_3D')|isequal(nom_type,'_i1-i2_j')
     244elseif isequal(nom_type,'_i1-i2_j')
    285245    dirpair=dir([filebasesub '_' num2str(num_i1) '-*_' num2str(num_j1) '.nc']);
    286 elseif isequal(nom_type,'netc_series')|isequal(nom_type,'_i1-i2')
     246elseif isequal(nom_type,'_i1-i2')
    287247    dirpair=dir([filebasesub '_' num2str(num_i1) '-*.nc']);
    288248    if isempty(dirpair)
     
    293253if nbpair >= 1 %choose the most recent file if several are found
    294254    idetect=1; %detected pair
     255    datepair=zeros(1,nbpair);%default
    295256    for ipair=1:nbpair
    296257         date_str=dirpair(ipair).date;%string of the date of last modification
    297          datepair(ipair)=0;%default
    298258         char_code=double(date_str);% code of the date characters
    299259         special_char=(char_code>127); %non standard Ascii character (e.g. date in french)
     
    301261             datepair(ipair)=datenum(date_str);
    302262         end   
    303       %  datepair(ipair)=datenum(dirpair(ipair).date);
    304263    end
    305264    [choice,indpair]=max(datepair);
    306 %     [filebase,field_count,str2,str_a,str_b,ext,nom_type]=name2display(dirpair(indpair).name);
    307     [pathname,file,field_count,str2,str_a,str_b,ext,nom_type]=name2display(dirpair(indpair).name);
    308     num_i1=str2num(field_count);
    309     num_i2=str2num(str2);
    310     num_j1=stra2num(str_a);
    311     num_j2=stra2num(str_b);
     265    [pathname,file,field_count,str2,str_a,str_b]=name2display(dirpair(indpair).name);
     266    num_i1=str2double(field_count);
     267    num_i2=str2double(str2);
     268    num_j1=stra2double(str_a);
     269    num_j2=stra2double(str_b);
    312270     pathname=fileparts(filebasesub);% CORRIGE LE 6 JUIN (ETAIT DESACTIVE)
    313271    filename=fullfile(pathname,dirpair(indpair).name);
  • trunk/src/nc2struct.m

    r100 r127  
    9898           if ischar(valuestr) && length(valuestr)<200
    9999                iatt_g=iatt_g+1;
    100                 indstr1=regexp(keystr,'\\');%detect '\\'
    101                 indstr2=regexp(keystr,'\.');%detect '\.'
     100                indstr1=regexp(keystr,'\\','once');%detect '\\'
     101                indstr2=regexp(keystr,'\.','once');%detect '\.'
    102102                if isempty(indstr1) && isempty(indstr2)
    103103                    eval(['Data.' keystr '=''' valuestr ''';'])
     
    228228    %select the used dimensions
    229229    if ~isempty(var_read)
    230 %         if isfield(Data,'ListDimName') %&& isfield(Data,'DimValue')
    231 %         Data=rmfield(Data,'ListDimName');
    232 %         %Data=rmfield(Data,'DimValue');
    233 %         end
    234 %     else
    235 %         list_dim=1:ndims;
    236230        dim_index=find(flag_used);
    237 %         list_dim=list_dim(dim_index);
    238231        old2new=cumsum(flag_used);
    239232        ListDimName=ListDimName(dim_index);
     
    241234    end
    242235    for ivar=1:length(var_read)
    243         %Data.VarDimIndex{ivar}=old2new(VarDimIndex{ivar});% ENLEVER Data.VarDimIndex ulterieurement
    244         %Data.VarDimName{ivar}=Data.ListDimName(Data.VarDimIndex{ivar});
    245236        Data.VarDimName{ivar}=ListDimName(old2new(VarDimIndex{ivar}));
    246237    end
     
    257248            end
    258249            eval(['Data.' VarName '=double(netcdf.getVar(nc,var_index(ivar)-1));'])%read the variable data
    259             %eval(['siz=size(Data.' VarName ');'])
    260            % if numel(siz)<=2
    261             %eval(['Data.' VarName '=Data.' VarName ''';'])%read the variable data
    262             %end
    263250        end
    264251    end
  • trunk/src/read_civxdata.m

    r93 r127  
    9797test_civ2=isequal(VelTypeOut,'civ2')||isequal(VelTypeOut,'interp2')||isequal(VelTypeOut,'filter2');
    9898if test_civ1
    99     Field.Time=Field.absolut_time_T0;
     99    Field.Time=double(Field.absolut_time_T0);
     100    Field.dt=double(Field.dt);
    100101elseif test_civ2
    101     Field.Time=Field.absolut_time_T0_2;
    102     Field.dt=Field.dt2;
     102    Field.Time=double(Field.absolut_time_T0_2);
     103    Field.dt=double(Field.dt2);
    103104else
    104105    Field.Txt='the input file is not civx';
     
    136137% rescale to pixel coordiantes
    137138if isfield(Field,'pixcmx')
     139Field.pixcmx=double(Field.pixcmx);
     140Field.pixcmy=double(Field.pixcmy);
    138141Field.U=Field.U*Field.pixcmx;
    139142Field.V=Field.V*Field.pixcmy;
  • trunk/src/series/merge_proj.m

    r116 r127  
    295295     
    296296            if ~isempty(NbSlice_calib)
    297                 Field{iview}.ZIndex=mod(num_i1{iview}(ifile)-1,NbSlice_calib{1})+1
     297                Field{iview}.ZIndex=mod(num_i1{iview}(ifile)-1,NbSlice_calib{1})+1;
    298298            end
    299299%              Field{iview}.ZIndex=1;
    300300            if ~isempty(transform_fct)
    301                 XmlData{iview}.GeometryCalib
    302                 Field{iview}=transform_fct(Field{iview},XmlData{iview});               
    303                 %transform to phys if requested
     301                Field{iview}=transform_fct(Field{iview},XmlData{iview});  %transform to phys if requested
    304302            end
    305303            if testcivx
  • trunk/src/sub_field.m

    r109 r127  
    181181       else
    182182           AName=Field.ListVarName{ivar_C};
    183           size(Field.vort)
     183          % size(Field.vort)
    184184           eval(['SubData.' AName '=Field.' AName '-vec_A_1;'])
    185185       end
  • trunk/src/uvmat.m

    r122 r127  
    17551755
    17561756comp_input=get(handles.fix_pair,'Value');
    1757 % if isequal(NomType,'_i1-i2')||isequal(NomType,'_i1-i2_j')
    1758 %     comp_input=1; %impose a fixed pair
    1759 %     set(handles.fix_pair,'Value',1)
    1760 % end
    17611757
    17621758%case of scanning along the first direction (rootfile numbers)
     
    17641760     num1=num1+increment;
    17651761     num2=num2+increment;
    1766      [filename,num1,num_a,num2,num_b]=name_generator(filebase,num1,num_a,FileExt,NomType,comp_input,num2,num_b,subdir);
     1762     [filename,num1,num_a,num2,num_b]=name_generator(filebase,num1,num_a,FileExt,NomType,comp_input,num2,num_b,subdir)
    17671763     if sub_value% set the second field name and indices
    17681764        num1_1=num1_1+increment;
     
    17731769    num_a=num_a+increment;
    17741770    num_b=num_b+increment;
     1771    [filename,num1,num_a,num2,num_b]=name_generator(filebase,num1,num_a,FileExt,NomType,comp_input,num2,num_b,subdir);
    17751772    if sub_value
    17761773        num_a_1=num_a_1+increment;
    17771774        num_b_1=num_b_1+increment;
    17781775        filename_1=name_generator(filebase_1,num1_1,num_a_1,FileExt_1,NomType_1,1,num2_1,num_b_1,SubDir_1);
    1779 %     else % redefine the j index if it exceeds its upper bound (only in the absence of a second field)
    1780 %         lastfield_cell=get(handles.last_j,'String'); % get the last field number
    1781 %         lastfield=str2double(lastfield_cell{1});
    1782 %         if num_a>lastfield && ~isnan(lastfield)
    1783 %             num_a=mod(num_a,lastfield);
    1784 %             num_b=mod(num_b,lastfield)
    1785 %         end
    1786     end
    1787     [filename,num1,num_a,num2,num_b]=name_generator(filebase,num1,num_a,FileExt,NomType,comp_input,num2,num_b,subdir);
     1776    end   
    17881777end
    17891778
Note: See TracChangeset for help on using the changeset viewer.