Changeset 353


Ignore:
Timestamp:
Dec 29, 2011, 12:00:59 AM (12 years ago)
Author:
sommeria
Message:

functions adapted to Matlab version 2009 (~ replaced by 'tild' in function output)
svn test put under 'try' (error observed)
fullfile_uvmat introduced, aimed at replacing name_generator

Location:
trunk/src
Files:
1 added
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/check_files.m

    r315 r353  
    5151    'editxml';...%display and edit xml files using a xls schema
    5252    'editxml.fig';...%interface for editxml
     53    'fileparts_uvmat';...% extracts the root name,field indexes and nomenclature type from an input filename
    5354    'find_field_indices';...% group the variables of a nc-formated Matlab structure into 'fields' with common dimensions
    5455    'geometry_calib';...%performs geometric calibration from a set of reference points
     
    6667    'msgbox_uvmat';... associated with GUI msgbox_uvmat.fig to display message boxes, for error, warning or input calls
    6768    'msgbox_uvmat.fig';...
    68     'name2display';...% extracts the root name and field numbers from an input filename
    6969    'name_generator';...%creates a file name from a root name and indices.
    7070    'nc2struct';...% transform a netcdf file in a corresponding matlab structure
     
    138138end
    139139date_str=datestr(max(datnum));
    140 
    141 [status,~]=system('svn --help');
     140try
     141[status]=system('svn --help');
    142142if status==0
    143     [~,result]=system(['svn info ' dir_fct]);
     143    [tild,result]=system(['svn info ' dir_fct]);
    144144    t=regexp(result,'R.vision\s:\s(?<rev>\d+)','names');
    145145    svn_info.cur_rev=str2double(t.rev);
    146     [~,result]=system(['svn info -r ''HEAD'' '  dir_fct]);
     146    [tild,result]=system(['svn info -r ''HEAD'' '  dir_fct]);
    147147    t=regexp(result,'R.vision\s:\s(?<rev>\d+)','names');
    148148    svn_info.rep_rev=str2double(t.rev);
    149     [~,result]=system(['svn status'  dir_fct]);   
     149    [tild,result]=system(['svn status'  dir_fct]);   
    150150    svn_info.status=result;
    151151    if svn_info.rep_rev>svn_info.cur_rev
     
    161161    end
    162162end
     163end
    163164errormsg=errormsg';
    164165
  • trunk/src/civ.m

    r344 r353  
    180180end
    181181%[RootPath,RootFile,str1,str2,str_a,str_b,FileExt,NomType,subdir]=name2display(fileinput);
    182 [~,~,~,i1,i2,j1,j2,FileExt,NomType]=fileparts_uvmat(fileinput);
     182[tild,tild,tild,i1,i2,j1,j2,FileExt,NomType]=fileparts_uvmat(fileinput);
    183183% filebase=fullfile(RootPath,RootFile);
    184184
     
    351351
    352352% form=imformats(ext_input(2:end));
     353check_letter=0;
     354check_separator=0;
    353355if ~isempty(ext_input)&&(~isempty(imformats(ext_input(2:end)))||strcmpi(ext_input,'.avi'))% if the extension corresponds to an image or movie format recognized by Matlab
    354356    ext_ima=ext_input;
    355357    nom_type_ima=nom_type_input;
    356358    imagename=fileinput;
     359    check_letter=~isempty(regexp(nom_type_ima,'[a|A]$'));%detect pair label by letter
    357360else %case of netcdf input file, look for corresponding images
    358361    nom_type_nc=nom_type_input;
    359     imagename=name_generator(fullfile(RootPath,RootFile),1,1,ext_ima,nom_type_ima);
     362    imagename=fullfile_uvmat(RootPath,[],RootFile,ext_ima,nom_type_ima,1,[],1);
     363    %imagename=name_generator(fullfile(RootPath,RootFile),1,1,ext_ima,nom_type_ima);
    360364    i1_str='';
    361365    j1_str='';
     
    367371    %TODO: read the image name in the netcdf file (if documented)
    368372    %look for double image series '_i_j'
    369     check_letter=regexp(nom_type_nc,'[ab|AB]$');%detect pair label by letter
    370     if ~isempty(check_letter)
     373    check_letter=~isempty(regexp(nom_type_nc,'[ab|AB]$'));%detect pair label by letter
     374    if check_letter
    371375        j1_str=nom_type_nc(end-1);
    372376        r=regexp(nom_type_nc,'_(?<num1>\d+)','names');
     
    378382        r_end=regexp(NomTypeIma,'.\D(?<num2>\d+$','names');
    379383        if ~isempty(r_end)
    380             j1_str=r.num2
     384            j1_str=r.num2;
    381385        end
    382386    end
     
    401405    for ilist=1:numel(dirima)
    402406        %[pp,ff,i1_str,i2_str,j1_str,j2_str,ext_list,nom_type_list]=name2display(dirima(ilist).name);
    403         [~,~,~,i1,i2,j1,j2,ext_list,nom_type_list]=fileparts_uvmat(dirima(ilist).name);
     407        [tild,tild,tild,i1,i2,j1,j2,ext_list,nom_type_list]=fileparts_uvmat(dirima(ilist).name);
    404408        form=imformats(ext_list(2:end));
    405409        if ~isempty(form)% if the extension corresponds to an image format recognized by Matlab
     
    432436    end
    433437end
    434 [RootPath,RootFile,i1_series,~,j1_series,~,NomType,FileType,Object]=find_file_series(imagename);
     438[RootPath,RootFile,i1_series,tild,j1_series,tild,NomType,FileType,Object]=find_file_series(imagename);
    435439MaxIndex_i=max(i1_series(i1_series>0));
    436440MaxIndex_j=max(j1_series(j1_series>0));
     
    464468    switch ext_imadoc
    465469        case '.civxml'%OBSOLETE
    466             [~,~,time]=read_civxml([RootName '.civxml']);
     470            [tild,tild,time]=read_civxml([RootName '.civxml']);
    467471            mode='pair j1-j2';
    468472            if isempty(nom_type_ima)% dtermine types by default if not already selected by browser or uvmat
     
    475479            if isfield(XmlData,'Heading')&&isfield(XmlData.Heading','ImageName')&&ischar(XmlData.Heading.ImageName)% get image nom type and extension from the xml file
    476480                %[PP,FF,fc,str2,str_a,str_b,ext_ima_read,nom_type_read]=name2display(XmlData.Heading.ImageName);
    477                 [~,~,~,~,~,~,~,~,nom_type_read]=fileparts_uvmat(XmlData.Heading.ImageName);
     481                [tild,tild,tild,tild,tild,tild,tild,tild,nom_type_read]=fileparts_uvmat(XmlData.Heading.ImageName);
    478482                fullname=fullfile(fileparts(RootName),XmlData.Heading.ImageName); %full name (including path) of the first image defined by the xmle file,
    479483                if ~exist(fullname,'file')
     
    590594% test_ima_i=numel(nom_type_ima)>1 && isempty(regexp(nom_type_ima(2:end),'\D','once'))%=1 for images with single indexing
    591595% TODO: determine MaxIndex_i and MaxIndex_j using find_file_series (in the absence of xml file)
    592 try
    593 if (~check_letter&&~check_separator)|| isequal(nom_type_nc,'_1-2')|| (MaxIndex_j==1)
     596% try
     597if ~check_letter|| isequal(nom_type_nc,'_1-2')|| (MaxIndex_j==1)
    594598    set(handles.ListPairMode,'Value',1)
    595599    set(handles.ListPairMode,'String',{'series(Di)'})   
    596 elseif  MaxIndex_i==1 && MaxIndex_j% simple series in j
     600elseif  MaxIndex_i==1 && MaxIndex_j>1% simple series in j
    597601    set(handles.ListPairMode,'String',{'pair j1-j2';'series(Dj)'})
    598602    if  MaxIndex_j <= 10
     
    605609    end
    606610end
    607 end
     611% end
    608612
    609613%% update the subdirectory display
     
    18051809    filebase_nc=filebase_B;
    18061810end
    1807 
     1811    [RootPath_ima1,RootFile_ima1]=fileparts(filebase_ima1);
     1812    [RootPath_ima2,RootFile_ima2]=fileparts(filebase_ima2);
     1813    [RootPath_nc,RootFile_ima1]=fileparts(filebase_nc);
     1814   
    18081815%determine reference files for fix:
    18091816file_ref_fix1={};%default
     
    18241831        if isequal(mode,'displacement')
    18251832            num_i1=num_i_ref;
    1826             num_i2=num_i_ref;
     1833 name_genna           num_i2=num_i_ref;
    18271834            num_j1=num_j_ref;
    18281835            num_j2=num_j_ref;
     
    18521859        for ifile=1:nbfield
    18531860            for j=1:nbslice
    1854                 file_ref=name_generator(ref.filebase,num_i1(ifile),num_j1(j),'.nc',ref.nom_type,1,num_i2(ifile),num_j2(j),ref.subdir);%
     1861                [RootPath,RootFile]=fileparts(ref.filebase);
     1862                file_ref=fullfile_uvmat(RootPath,ref.subdir,RootFile,'.nc',ref.nom_type,num_i1(ifile),num_i2(ifile),num_j1(j),num_j2(j));
     1863%                 file_ref=name_generator(ref.filebase,num_i1(ifile),num_j1(j),'.nc',ref.nom_type,1,num_i2(ifile),num_j2(j),ref.subdir);%
    18551864                file_ref_fix1(ifile,j)={file_ref};
    18561865                if ~exist(file_ref,'file')
     
    19031912        for ifile=1:nbfield
    19041913            for j=1:nbslice
    1905                 file_ref=name_generator(ref.filebase,num_i1(ifile),num_j1(j),'.nc',ref.nom_type,1,num_i2(ifile),num_j2(j),ref.subdir);%
     1914                [RootPath,RootFile]=fileparts(ref.filebase);
     1915                file_ref=fullfile_uvmat(RootPath,ref.subdir,RootFile,'.nc',ref.nom_type,num_i1(ifile),num_i2(ifile),num_j1(j),num_j2(j));
     1916                %file_ref=name_generator(ref.filebase,num_i1(ifile),num_j1(j),'.nc',ref.nom_type,1,num_i2(ifile),num_j2(j),ref.subdir);%
    19061917                file_ref_fix2(ifile,j)={file_ref};
    19071918                if ~exist(file_ref,'file')
     
    19441955        for ifile=1:nbfield
    19451956            for j=1:nbslice
     1957                [RootPath,RootFile]=fileparts(ref.filebase_nc);
    19461958                filename=name_generator(filebase_nc,num1_civ1(ifile),num_a_civ1(j),'.nc',nom_type_nc,1,num2_civ1(ifile),num_b_civ1(j),subdir_civ1_new);
    19471959                detect=exist(filename,'file')==2;
     
    22042216        for ifile=1:nbfield
    22052217            for j=1:nbslice
    2206                 filename=name_generator(filebase_nc,num1_civ1(ifile),num_a_civ1(j),'.nc',...
    2207                     nom_type_nc,1,num2_civ1(ifile),num_b_civ1(j),subdir_civ1);%
     2218                filename=fullfile_uvmat(RootPath_nc,subdir_civ1,RootFile_nc,'.nc',nom_type_nc,num1_civ1(ifile),num2_civ1(ifile),num_a_civ1(j),num_b_civ1(j));
     2219                %filename=name_generator(filebase_nc,num1_civ1(ifile),num_a_civ1(j),'.nc',...
     2220%                     nom_type_nc,1,num2_civ1(ifile),num_b_civ1(j),subdir_civ1);%
    22082221                filecell.nc.civ1(ifile,j)={filename};% name of the civ1 file
    22092222                if ~exist(filename,'file')
     
    22442257            for ifile=1:nbfield
    22452258                for j=1:nbslice
    2246                     filename=name_generator(filebase_A,num1_civ2(ifile),num_a_civ2(j),'.nc',...
    2247                         nom_type_nc,1,num2_civ2(ifile),num_b_civ2(j),subdir_civ2);%
     2259                    filename=fullfile_uvmat(RootPath_A,subdir_civ2,RootFile_A,'.nc',nom_type_nc,num1_civ2(ifile),num2_civ2(ifile),num_a_civ2(j),num_b_civ2(j));
     2260%                     filename=name_generator(filebase_A,num1_civ2(ifile),num_a_civ2(j),'.nc',...
     2261%                         nom_type_nc,1,num2_civ2(ifile),num_b_civ2(j),subdir_civ2);%
    22482262                    filecell.ncA.civ2(ifile,j)={filename};
    22492263                    if ~exist(filename,'file')
     
    22622276    for ifile=1:nbfield
    22632277        for j=1:nbslice
    2264             filename=name_generator(filebase_nc,num1_civ2(ifile),num_a_civ2(j),'.nc',...
    2265                 nom_type_nc,1,num2_civ2(ifile),num_b_civ2(j),subdir_civ2);
     2278            filename=fullfile_uvmat(RootPath_nc,subdir_civ2,RootFile_nc,'.nc',nom_type_nc,num1_civ2(ifile),num2_civ2(ifile),num_a_civ2(j),num_b_civ2(j));
     2279%             filename=name_generator(filebase_nc,num1_civ2(ifile),num_a_civ2(j),'.nc',...
     2280%                 nom_type_nc,1,num2_civ2(ifile),num_b_civ2(j),subdir_civ2);
    22662281            detect=exist(filename,'file')==2;
    22672282            filecell.nc.civ2(ifile,j)={filename};
     
    22742289        for ifile=1:nbfield
    22752290            for j=1:nbslice
    2276                 filename=name_generator(filebase_ima1, num1_civ2(ifile),num_a_civ2(j),ext_ima,nom_type_ima1);
     2291                filename=fullfile_uvmat(RootPath_ima1,[],RootFile_ima1,ext_ima,nom_type_ima1,num1_civ2(ifile),num2_civ2(ifile),num_a_civ2(j),num_b_civ2(j));
     2292                %filename=name_generator(filebase_ima1, num1_civ2(ifile),num_a_civ2(j),ext_ima,nom_type_ima1);
    22772293                idetect_2(j)=exist(filename,'file')==2;
    22782294                filecell.ima1.civ2(ifile,j)={filename};%first image
     
    22932309        for ifile=1:nbfield
    22942310            for j=1:nbslice
    2295                 filename=name_generator(filebase_ima2, num2_civ2(ifile),num_b_civ2(j),ext_ima,nom_type_ima2);
     2311                filename=fullfile_uvmat(RootPath_ima2,[],RootFile_ima2,ext_ima,nom_type_ima2,num1_civ2(ifile),num2_civ2(ifile),num_a_civ2(j),num_b_civ2(j));
     2312               % filename=name_generator(filebase_ima2, num2_civ2(ifile),num_b_civ2(j),ext_ima,nom_type_ima2);
    22962313                idetect_3(j)=exist(filename,'file')==2;
    22972314                filecell.ima2.civ2(ifile,j)={filename};%first image
     
    23122329        for ifile=1:nbfield
    23132330            for j=1:nbslice
    2314                 filename=name_generator(filebase_nc,num1_civ2(ifile),num_a_civ2(j),'.nc',...
    2315                     nom_type_nc,1,num2_civ2(ifile),num_b_civ2(j),subdir_civ2);%
     2331                 filename=fullfile_uvmat(RootPath_nc,subdir_civ2,RootFile_nc,'.nc',nom_type_nc,num1_civ2(ifile),num2_civ2(ifile),num_a_civ2(j),num_b_civ2(j));
     2332%                 filename=name_generator(filebase_nc,num1_civ2(ifile),num_a_civ2(j),'.nc',...
     2333%                     nom_type_nc,1,num2_civ2(ifile),num_b_civ2(j),subdir_civ2);%
    23162334                filecell.nc.civ2(ifile,j)={filename};
    23172335                if ~exist(filename,'file')
     
    23412359        for ifile=1:nbfield
    23422360            for j=1:nbslice
    2343                 filename=name_generator(filebase_AB,num1_civ1(ifile),num_a_civ1(j),'.nc',...
    2344                     nom_type_nc,1,num2_civ1(ifile),num_b_civ1(j),subdir_civ1);%
     2361                 filename=fullfile_uvmat(RootPath_AB,subdir_civ1,RootFile_AB,'.nc',nom_type_nc,num1_civ1(ifile),num2_civ1(ifile),num_a_civ1(j),num_b_civ1(j));
     2362%                 filename=name_generator(filebase_AB,num1_civ1(ifile),num_a_civ1(j),'.nc',...
     2363%                     nom_type_nc,1,num2_civ1(ifile),num_b_civ1(j),subdir_civ1);%
    23452364                filecell.st(ifile,j)={filename};
    23462365            end
     
    23502369        for ifile=1:nbfield
    23512370            for j=1:nbslice
    2352                 filename=name_generator(filebase_AB,num1_civ2(ifile),num_a_civ2(j),'.nc',...
    2353                     nom_type_nc,1,num2_civ2(ifile),num_b_civ2(j),subdir_civ2);%
     2371                 filename=fullfile_uvmat(RootPath_AB,subdir_civ2,RootFile_AB,'.nc',nom_type_nc,num1_civ2(ifile),num2_civ2(ifile),num_a_civ2(j),num_b_civ2(j));
     2372%                 filename=name_generator(filebase_AB,num1_civ2(ifile),num_a_civ2(j),'.nc',...
     2373%                     nom_type_nc,1,num2_civ2(ifile),num_b_civ2(j),subdir_civ2);%
    23542374                filecell.st(ifile,j)={filename};
    23552375            end
     
    24302450            waitbar(ifile/nbfield);
    24312451            for j=1:nbslice
    2432                 filename=name_generator(filebase_ima1,num1_civ1(ifile),num_a_civ1(j),'.png',nom_type_imanew1);
     2452                 filename=fullfile_uvmat(RootPath_ima1,[],RootFile_ima1,'.png',nom_type_imanew1,num1_civ1(ifile),num2_civ1(ifile),num_a_civ1(j),num_b_civ1(j));
     2453%                 filename=name_generator(filebase_ima1,num1_civ1(ifile),num_a_civ1(j),'.png',nom_type_imanew1);
    24332454                if ~exist(filename,'file')
    24342455                    A=read_image(filecell.ima1.civ1{ifile,j},type_ima1,num1_civ1(ifile),movieobject1);
     
    24362457                end
    24372458                filecell.ima1.civ1(ifile,j)={filename};
    2438                 filename=name_generator(filebase_ima2, num2_civ1(ifile),num_b_civ1(j),'.png',nom_type_imanew2);
     2459                filename=fullfile_uvmat(RootPath_ima2,[],RootFile_ima2,'.png',nom_type_imanew2,num2_civ1(ifile),num2_civ1(ifile),num_b_civ1(j),num_b_civ1(j));
     2460                %filename=name_generator(filebase_ima2, num2_civ1(ifile),num_b_civ1(j),'.png',nom_type_imanew2);
    24392461                if ~exist(filename,'file')
    24402462                    A=read_image(filecell.ima2.civ1{ifile,j},type_ima2,num2_civ1(ifile),movieobject2);
     
    24512473            waitbar(ifile/nbfield);
    24522474            for j=1:nbslice
    2453                 filename=name_generator(filebase_ima1,num1_civ2(ifile),num_a_civ2(j),'.png',nom_type_imanew1);
     2475                filename=fullfile_uvmat(RootPath_ima1,[],RootFile_ima1,'.png',nom_type_imanew1,num1_civ2(ifile),[],num_a_civ1(j));
     2476                %filename=name_generator(filebase_ima1,num1_civ2(ifile),num_a_civ2(j),'.png',nom_type_imanew1);
    24542477                if ~exist(filename,'file')
    24552478                    A=read_image(cell2mat(filecell.ima1.civ2(ifile,j)),type_ima2,num1_civ2(ifile));
     
    26192642%     set(handles.RootName_1,'String',name);
    26202643    %[RootPath,RootFile,field_count,str2,str_a,str_b,xx,nom_type,SubDir]=name2display(name);
    2621     [~,~,RootFile,~,~,~,~,~,nom_type]=fileparts_uvmat(name);
     2644    [tild,tild,RootFile,tild,tild,tild,tild,tild,nom_type]=fileparts_uvmat(name);
    26222645    set(handles.RootName_1,'String',RootFile);
    26232646    browse=get(handles.RootName,'UserData');
     
    28402863find_netcpair_civ1( handles)
    28412864find_netcpair_civ2(handles)
    2842 'TESTin'
    2843 browse=get(handles.RootName,'UserData')
     2865browse=get(handles.RootName,'UserData');
    28442866
    28452867%------------------------------------------------------------------------
  • trunk/src/fileparts_uvmat.m

    r352 r353  
    242242for FileName=FileName_list
    243243%     [RootPath,RootFile,i1,i2,str_a,str_b,FileExt,NomType,SubDir]=name2display(FileName{1});
    244     [~,SubDir,RootFile,i1,i2,j1,j2,~,NomType]=...
     244    [tild,SubDir,RootFile,i1,i2,j1,j2,tild,NomType]=...
    245245        fileparts_uvmat(FileName{1});
    246246    fprintf([...
  • trunk/src/find_file_series.m

    r350 r353  
    4040
    4141%% get input root name and nomenclature type
    42 [RootPath,SubDir,RootFile,~,i2_input,j1_input,j2_input,FileExt,NomType]=fileparts_uvmat(fileinput);
     42[RootPath,SubDir,RootFile,tild,i2_input,j1_input,j2_input,FileExt,NomType]=fileparts_uvmat(fileinput);
    4343
    4444%% check for particular file types: images, movies, civ data
     
    128128    end
    129129    for ifile=1:nbpair
    130         [~,~,~,i1,i2,j1,j2]=fileparts_uvmat(dirpair(ifile).name);
     130        [tild,tild,tild,i1,i2,j1,j2]=fileparts_uvmat(dirpair(ifile).name);
    131131        ref_i=i1;
    132132        if isempty(i2_input)
     
    184184        ref_ij=ref_i_list*max_j+ref_j_list; % ordered by index i, then by j for a given i.
    185185    end
    186     [~,ifile]=min(ref_ij(ref_ij>0));
     186    [tild,ifile]=min(ref_ij(ref_ij>0));
    187187    if isempty(ifile)
    188188        RootPath='';
     
    190190        NomType='';
    191191    else
    192     [~,~,~,~,~,~,~,~,NomType]=fileparts_uvmat(dirpair(ifile).name);
     192    [tild,tild,tild,tild,tild,tild,tild,tild,NomType]=fileparts_uvmat(dirpair(ifile).name);
    193193    end
    194194end
     
    203203if size(i2_series,3)>1 %pairs i1 -i2
    204204    diff_index=abs(i2_series-i1_series);
    205     [~,ind_pair]=sort(diff_index,3,'descend');
     205    [tild,ind_pair]=sort(diff_index,3,'descend');
    206206    for ref_i=1:size(i1_series,1)
    207207        for ref_j=1:size(j1_series,2)
     
    215215elseif size(j2_series,3)>1 %pairs j1 -j2
    216216    diff_index=abs(j2_series-j1_series);
    217     [~,ind_pair]=sort(diff_index,3,'descend');
     217    [tild,ind_pair]=sort(diff_index,3,'descend');
    218218    for ref_i=1:size(i1_series,1)
    219219        for ref_j=1:size(j1_series,2)
  • trunk/src/series.m

    r351 r353  
    12961296       if ~isempty(r)
    12971297           if strcmp(r.num1,'*')%free pairs
    1298                [~,RootFile,i1_series,i2_series,j1_series,j2_series,~,~,Object]=find_file_series(fileinput)% TODO: choice pair when multiple choice
     1298               [tild,RootFile,i1_series,i2_series,j1_series,j2_series,tild,tild,Object]=find_file_series(fileinput)% TODO: choice pair when multiple choice
    12991299 
    13001300               if isempty(i2_series) %j pairs
     
    23082308    return
    23092309end
    2310 [~,~,FileExt]=fileparts(fileinput);
     2310[tild,tild,FileExt]=fileparts(fileinput);
    23112311
    23122312MinIndex=get(handles.MinIndex,'Data');
  • trunk/src/stra2num.m

    r89 r353  
    1212
    1313function numres=stra2num(str)
    14 numres=NaN; %default
     14numres=[]; %default
    1515if double(str) >= 48 & double(str) <= 57 % = test for number strings
    1616    numres=str2double(str);
  • trunk/src/uvmat.m

    r342 r353  
    474474end
    475475% detect root name, nomenclature and indices in the input file name:
    476 [~,SubDir,~,i1,i2,j1,j2,FileExt]=fileparts_uvmat(fileinput);
     476[ff,SubDir,ii,i1,i2,j1,j2,FileExt]=fileparts_uvmat(fileinput);
    477477% detect the file type, get the movie object if relevant, and look for the corresponding file series:
    478478% [i1_series,i2_series,j1_series,j2_series,NomType,FileType,MovieObject]=find_file_series(fileinput);
     
    510510        set(handles.i1,'String',num2str(i1));   
    511511        set(handles.i2,'String',num2str(i2));
    512         set(handles.j1,'String',num2str(j1));
    513         set(handles.j2,'String',num2str(j2));
     512        set(handles.j1,'String',num2stra(j1,NomType));
     513        set(handles.j2,'String',num2stra(j2,NomType));
    514514       
    515515        % synchronise indices of the second  input file if it exists
    516516        if get(handles.SubField,'Value')==1% if the subfield button is activated, update the field numbers
    517             [ff,rr,FileBase_1,ii,FileExt_1,SubDir_1]=read_file_boxes_1(handles);
    518             NomType_1=get(handles.NomType_1,'String');
     517            Input=read_GUI(handles.InputFile);
     518            if ~isfield(Input,'RootPath_1')
     519                Input.RootPath_1=Input.RootPath;
     520            end
     521            if ~isfield(Input,'SubDir_1')
     522                Input.SubDir_1=Input.SubDir;
     523            end
     524            if ~isfield(Input,'RootFile_1')
     525                Input.SubDir_1=Input.RootFile;
     526            end
     527%             [ff,rr,FileBase_1,ii,FileExt_1,SubDir_1]=read_file_boxes_1(handles);
     528%             NomType_1=get(handles.NomType_1,'String');
    519529%             NomType_1=get(handles.FileIndex_1,'UserData');     
    520             FileName_1=name_generator(FileBase_1,i1,i2,FileExt_1,NomType_1,1,j1,j2,SubDir_1);
     530           % FileName_1=name_generator(FileBase_1,i1,i2,FileExt_1,NomType_1,1,j1,j2,SubDir_1);
     531            FileName_1=fullfile_uvmat(Input.RootPath_1,Input.SubDir_1,Input.RootFile_1,Input.FileExt_1,Input.NomType_1,i1,i2,j1,j2);
    521532            if exist(FileName_1,'file')
    522533                FileIndex_1=name_generator('',i1,i2,'',NomType_1,1,j1,j2,'');
     
    555566fileinput=read_file_boxes(handles);
    556567% detect the file type, get the movie object if relevant, and look for the corresponding file series:
    557 [RootPath,RootFile,i1_series,i2_series,j1_series,j2_series,~,FileType,MovieObject]=find_file_series(fileinput);
     568[RootPath,RootFile,i1_series,i2_series,j1_series,j2_series,tild,FileType,MovieObject]=find_file_series(fileinput);
    558569% initiate the input file series and refresh the current field view:
    559570update_rootinfo(handles,i1_series,i2_series,j1_series,j2_series,FileType,MovieObject);
     
    578589function FileIndex_Callback(hObject, eventdata, handles)
    579590%------------------------------------------------------------------------
    580 [~,~,~,i1,i2,j1,j2]=fileparts_uvmat(get(handles.FileIndex,'String'));
     591[tild,tild,tild,i1,i2,j1,j2]=fileparts_uvmat(get(handles.FileIndex,'String'));
    581592set(handles.i1,'String',num2str(i1));
    582593set(handles.i2,'String',num2str(i2));
     
    599610UvData.TestInputFile=1;
    600611UvData.FileType=FileType;
     612UvData.i1_series=i1_series;
     613UvData.i2_series=i2_series;
     614UvData.j1_series=j1_series;
     615UvData.j2_series=j2_series;
    601616set(handles.fix_pair,'Value',1) % activate by default the comp_input '-'input window
    602617set(handles.FixVelType,'Value',0); %desactivate fixed veltype
     
    731746
    732747%% store last index in handles.lat_i and .last_j
    733 nbfield=max(i2_series);
     748nbfield=max(max(i2_series));
    734749if isempty(nbfield)
    735     nbfield=max(i1_series);
    736 end
    737 nbfield_j=max(j2_series);
     750    nbfield=max(max(i1_series));
     751end
     752nbfield_j=max(max(j2_series));
    738753if isempty(nbfield_j)
    739     nbfield_j=max(j1_series);
     754    nbfield_j=max(max(j1_series));
    740755end
    741756if ~isempty(XmlData.Time)
     
    10401055
    10411056%[path,name,ext]=fileparts(fileinput_1);
    1042 [~,SubDir_1,~,i1,i2,j1,j2,FileExt_1]=fileparts_uvmat(fileinput_1);
     1057[tild,SubDir_1,tild,i1,i2,j1,j2,FileExt_1]=fileparts_uvmat(fileinput_1);
    10431058[RootPath_1,RootFile_1,i1_series,i2_series,j1_series,j2_series,NomType,FileType,MovieObject]=find_file_series(fileinput_1);
    10441059% [RootPath_1,RootFile_1,field_count,str2,str_a,str_b,FileExt_1,NomType_1,SubDir_1]=name2display(fileinput_1);
     
    15211536        for ilist=1:length(maskfiles)
    15221537            maskname=maskfiles(ilist).name;% take the first mask file in the list
    1523             [~,~,~,~,~,~,~,MaskExt,Mask_NomType{ilist}]=fileparts_uvmat(maskname);
     1538            [tild,tild,tild,tild,tild,tild,tild,MaskExt,Mask_NomType{ilist}]=fileparts_uvmat(maskname);
    15241539%             [rr,ff,x1,x2,xa,xb,xext,Mask_NomType{ilist}]=name2display(maskname);
    1525              [~,Name]=fileparts(maskname);
     1540             [tild,Name]=fileparts(maskname);
    15261541            Namedouble=double(Name);
    15271542            val=(48>Namedouble)|(Namedouble>57);% select the non-numerical characters
     
    15721587            errormsg='no file browsed';
    15731588        end
    1574         [RootDir,~,RootFile,~,~,~,~,~,Mask.NomType]=fileparts_uvmat(maskname);
     1589        [RootDir,tild,RootFile,tild,tild,tild,tild,tild,Mask.NomType]=fileparts_uvmat(maskname);
    15751590%         [RootDir,RootFile,x1,x2,xa,xb,xext,Mask.NomType]=name2display(maskname);
    15761591        Mask.Base=fullfile(RootDir,RootFile);
     
    18341849NomType=get(handles.NomType,'String');
    18351850% NomType=get(handles.FileIndex,'UserData');
    1836 i1=stra2num(get(handles.i1,'String'));%read the field indices (for movie, it is not given by the file name)
    1837 i2=stra2num(get(handles.i2,'String'));
     1851i1=str2num(get(handles.i1,'String'));%read the field indices (for movie, it is not given by the file name)
     1852i2=str2num(get(handles.i2,'String'));
    18381853j1=stra2num(get(handles.j1,'String'));
    18391854j2=stra2num(get(handles.j2,'String'));
     
    18411856if sub_value % a second input file has been entered
    18421857    [FileName_1,RootPath_1,filebase_1,FileIndices_1,FileExt_1,SubDir_1]=read_file_boxes_1(handles);
    1843     [~,~,~,i1_1,i2_1,j1_1,j2_1]=fileparts_uvmat(FileIndices_1);
     1858    [tild,tild,tild,i1_1,i2_1,j1_1,j2_1]=fileparts_uvmat(FileIndices_1);
    18441859  %  [pp,ff,i1_1_str,i2_1_str,j1_1_str,j2_1_str]=name2display(FileIndices_1);
    18451860%     i1_1=stra2num(i1_1_str);%current set of indices for the second field (may be set different than the main indices)
     
    18551870
    18561871%% increment (or decrement) the field indices and update the input filename(s)
    1857 if get(handles.scan_i,'Value')==1% case of scanning along index i   
    1858      i1=i1+increment;
    1859      i2=i2+increment;
    1860      [filename,i1,j1,i2,j2]=name_generator(filebase,i1,j1,FileExt,NomType,comp_input,i2,j2,InputFile.SubDir);
    1861      if sub_value% set the second field name and indices
    1862         i1_1=i1_1+increment;
    1863         i2_1=i2_1+increment;
    1864         filename_1=name_generator(filebase_1,i1_1,j1_1,FileExt_1,NomType_1,1,i2_1,j2_1,SubDir_1);
    1865      end   
     1872if get(handles.scan_i,'Value')==1% case of scanning along index i
     1873    i1=i1+increment;
     1874    i2=i2+increment;
    18661875else % case of scanning along index j (burst numbers)
    18671876    j1=j1+increment;
    18681877    j2=j2+increment;
    1869     [filename,i1,j1,i2,j2]=name_generator(filebase,i1,j1,FileExt,NomType,comp_input,i2,j2,InputFile.SubDir);
    1870     if sub_value
    1871         j1_1=j1_1+increment;
    1872         j2_1=j2_1+increment;
    1873         filename_1=name_generator(filebase_1,i1_1,j1_1,FileExt_1,NomType_1,1,i2_1,j2_1,SubDir_1);
    1874     end   
     1878end
     1879if ~comp_input
     1880    UvData=get(handles.uvmat,'UserData');
     1881    ref_i=i1;
     1882    if ~isempty(i2)
     1883        ref_i=floor((i1+i2)/2);
     1884    end
     1885    ref_j=1;
     1886    if ~isempty(j1)
     1887        ref_j=j1;
     1888        if ~isempty(j2)
     1889            ref_j=floor((j1+j2)/2);
     1890        end
     1891    end
     1892    if ref_i+1>size(UvData.i1_series,1)
     1893        msgbox_uvmat('ERROR','maximum i index exceeded');
     1894        return
     1895    end
     1896    if ref_j+1>size(UvData.i1_series,2)
     1897        msgbox_uvmat('ERROR','maximum j index exceeded');
     1898        return
     1899    end
     1900    i1=UvData.i1_series(ref_i+1,ref_j+1,1);
     1901    if ~isempty(UvData.i2_series)
     1902        i2=UvData.i2_series(ref_i+1,ref_j+1,1);
     1903    end
     1904    if ~isempty(UvData.j1_series)
     1905        j1=UvData.j1_series(ref_i+1,ref_j+1,1);
     1906    end
     1907    if ~isempty(UvData.j2_series)
     1908        j2=UvData.j2_series(ref_i+1,ref_j+1,1);
     1909    end
     1910end
     1911filename=fullfile_uvmat(InputFile.RootPath,InputFile.SubDir,InputFile.RootFile,FileExt,NomType,i1,i2,j1,j2);
     1912% filename=name_generator(filebase,i1,j1,FileExt,NomType,comp_input,i2,j2,InputFile.SubDir);
     1913if sub_value
     1914    j1_1=j1_1+increment;
     1915    j2_1=j2_1+increment;
     1916    filename_1=name_generator(filebase_1,i1_1,j1_1,FileExt_1,NomType_1,1,i2_1,j2_1,SubDir_1);
    18751917end
    18761918
     
    18921934        set(handles.j2,'String',num2stra(j2,NomType,2));
    18931935    end
    1894     [indices]=name_generator('',i1,j1,'',NomType,1,i2,j2,'');
     1936   % [indices]=name_generator('',i1,j1,'',NomType,1,i2,j2,'');
     1937    indices=fullfile_uvmat('','','','',NomType,i1,i2,j1,j2);
    18951938    set(handles.FileIndex,'String',indices);
    18961939    if ~isempty(filename_1)
     
    28232866end
    28242867if isfield(UvData,'XmlData_1') && isfield(UvData.XmlData_1,'Time')
    2825     [~,~,~,num_i1,num_i2,num_j1,num_j2]=fileparts_uvmat(['xx' get(handles.FileIndex_1,'String') get(handles.FileExt_1,'String')]);
     2868    [tild,tild,tild,num_i1,num_i2,num_j1,num_j2]=fileparts_uvmat(['xx' get(handles.FileIndex_1,'String') get(handles.FileExt_1,'String')]);
    28262869  %  [P,F,str1,str2,str_a,str_b,E]=name2display(['xx' get(handles.FileIndex_1,'String') get(handles.FileExt_1,'String')]);
    28272870    if isempty(num_i2)
     
    31823225%read the rootfile input display
    31833226[FileName,RootPath,FileBase,FileIndices,FileExt]=read_file_boxes(handles);
    3184 [~,~,~,i1,i2,j1,j2,~,NomType]=fileparts_uvmat(['xxx' get(handles.FileIndex,'String') FileExt]);
     3227[tild,tild,tild,i1,i2,j1,j2,tild,NomType]=fileparts_uvmat(['xxx' get(handles.FileIndex,'String') FileExt]);
    31853228% [P,F,str1,str2,str_a,str_b,E,NomType]=name2display(['xxx' get(handles.FileIndex,'String') FileExt]);
    31863229NomTypeNew=NomType;%default
     
    32233266    end
    32243267end
    3225 indices=name_generator('',i1,j1,'',NomTypeNew,1,i2,j2,'');
     3268% indices=name_generator('',i1,j1,'',NomTypeNew,1,i2,j2,'');
     3269indices=fullfile_uvmat('','','',FileExt,NomTypeNew,i1,i2,j1,j2);
    32263270set(handles.FileIndex,'String',indices)
    32273271set(handles.NomType,'String',NomTypeNew)
     
    32633307%read the rootfile input display
    32643308[FileName,RootPath,FileBase,FileIndices,FileExt_1]=read_file_boxes_1(handles);
    3265 [~,~,~,i1,i2,j1,j2,~,NomType_1]=fileparts_uvmat(['xxx' get(handles.FileIndex,'String') FileExt_1]);
     3309[tild,tild,tild,i1,i2,j1,j2,tild,NomType_1]=fileparts_uvmat(['xxx' get(handles.FileIndex,'String') FileExt_1]);
    32663310% [P,F,str1,str2,str_a,str_b,E,NomType_1]=name2display(['xxx' get(handles.FileIndex,'String') FileExt_1]);
    32673311if isempty(NomType_1)|| strcmp(NomType_1,'')
    32683312    [FileName,RootPath,FileBase,FileIndices,FileExt_1]=read_file_boxes(handles);
    3269     [~,~,~,i1,i2,j1,j2,~,NomType_1]=fileparts_uvmat(['xxx' get(handles.FileIndex,'String') FileExt_1]);
     3313    [tild,tild,tild,i1,i2,j1,j2,tild,NomType_1]=fileparts_uvmat(['xxx' get(handles.FileIndex,'String') FileExt_1]);
    32703314 %   [P,F,str1,str2,str_a,str_b,E,NomType_1]=name2display(['xxx' get(handles.FileIndex,'String') FileExt_1]);
    32713315end
     
    33193363        end 
    33203364    end
    3321     imagename=name_generator(FileBase,i1,j1,'.png',NomTypeNew,1,i2,j2,'');
     3365%     imagename=name_generator(FileBase,i1,j1,'.png',NomTypeNew,1,i2,j2,'');
     3366    imagename=fullfile_uvmat(RootPath,SubDir,FileName,'.png',NomTypeNew,i1,i2,j1,j2);
    33223367    if ~exist(imagename,'file')
    33233368        [FileName,PathName] = uigetfile( ...
Note: See TracChangeset for help on using the changeset viewer.