Changeset 353 for trunk/src/uvmat.m


Ignore:
Timestamp:
Dec 29, 2011, 12:00:59 AM (9 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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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.