Changeset 398


Ignore:
Timestamp:
Apr 26, 2012, 12:12:43 PM (12 years ago)
Author:
sommeria
Message:

find_file_series corrected and rationalised, with induced transforms in uvmat, civ, series

Location:
trunk/src
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/civ.m

    r397 r398  
    395395
    396396%% scan the image file series
    397 [RootPath,FileName,ImaExt]=fileparts(fileinput);
    398 [RootFile,i1_series,tild,j1_series,tild,NomTypeIma,FileType,Object]=find_file_series(RootPath,[FileName ImaExt]);
    399 if strcmp(NomTypeInput,'*')% movies will be opened at the first frame
    400     i1=1;
    401     i2=[];
    402     j1=[];
    403     j2=[];
    404 end
     397[FilePath,FileName,ImaExt]=fileparts(fileinput);
     398% detect the file type, get the movie object if relevant, and look for the corresponding file series:
     399% the root name and indices may be corrected by including the first index i1 if a corresponding xml file exists
     400[RootPath,SubDir,RootFile,i1_series,i2_series,j1_series,j2_series,NomTypeIma,FileType,Object,i1,i2,j1,j2]=find_file_series(FilePath,[FileName ImaExt]);
     401
     402% [RootPath,FileName,ImaExt]=fileparts(fileinput);
     403% [RootFile,i1_series,tild,j1_series,tild,NomTypeIma,FileType,Object]=find_file_series(RootPath,[FileName ImaExt]);
     404% if strcmp(NomTypeInput,'*')% movies will be opened at the first frame
     405%     i1=1;
     406%     i2=[];
     407%     j1=[];
     408%     j2=[];
     409% end
    405410switch FileType
    406411    case {'image','multimage','video'}
     
    427432
    428433%% scan the images if a civ file has been opened
    429 % if ~isempty(NomTypeNc)
    430 % [tild,i1_series,tild,j1_series,tild,NomTypeIma,ImageType,Object]=find_file_series(RootPath,RootFile);
    431 % end
    432434MinIndex_i=min(i1_series(i1_series>0));
    433435MinIndex_j=min(j1_series(j1_series>0));
     
    26952697        [tild,RootFile_1]=fileparts(name);
    26962698    else
    2697         [tild,tild,RootFile_1,tild,tild,tild,tild,tild,nom_type_1]=fileparts_uvmat(fileinput);
    2698         [RootFile_1,i1_series,tild,j1_series,tild,nom_type_1,FileType,Object]=find_file_series(PathName,FileName);
     2699        [FilePath,FileName,Ext]=fileparts(fileinput);
     2700% detect the file type, get the movie object if relevant, and look for the corresponding file series:
     2701% the root name and indices may be corrected by including the first index i1 if a corresponding xml file exists
     2702[RootPath,SubDir,RootFile_1,i1_series,i2_series,j1_series,j2_series,nom_type_1,FileType,Object,i1,i2,j1,j2]=find_file_series(FilePath,[FileName Ext]);
     2703       
     2704       % [tild,tild,RootFile_1,tild,tild,tild,tild,tild,nom_type_1]=fileparts_uvmat(fileinput);
     2705        %[RootFile_1,i1_series,tild,j1_series,tild,nom_type_1,FileType,Object]=find_file_series(PathName,FileName);
    26992706        %check image nom type
    27002707        if ~strcmp(nom_type_1,get(handles.NomType,'String'))
  • trunk/src/find_file_series.m

    r397 r398  
    11%'find_file_series': check the content of an input file and find the corresponding file series
    22%--------------------------------------------------------------------------
    3 % function [RootPath,RootFile,i1_series,i2_series,j1_series,j2_series,NomType,FileType,Object]=find_file_series(fileinput)
     3% function [RootPath,RootFile,i1_series,i2_series,j1_series,j2_series,NomType,FileType,Object,i1_input,i2_input,j1_input,j2_input]=find_file_series(fileinput)
    44%
    55% OUTPUT:
     
    3737%AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
    3838
    39 function [RootFile,i1_series,i2_series,j1_series,j2_series,NomType,FileType,Object]=find_file_series(RootPath,fileinput)
     39function [RootPath,SubDir,RootFile,i1_series,i2_series,j1_series,j2_series,NomType,FileType,Object,i1_input,i2_input,j1_input,j2_input]=find_file_series(FilePath,fileinput)
    4040%------------------------------------------------------------------------
    41 if ~exist('option','var')
    42     option='all';
    43 end
     41
    4442%% get input root name and nomenclature type
    45 [tild,tild,RootFile,tild,i2_input,j1_input,j2_input,FileExt,NomType]=fileparts_uvmat(fileinput);
    46 fullfileinput=fullfile(RootPath,fileinput);% input file name with path
     43fullfileinput=fullfile(FilePath,fileinput);% input file name with path
     44[RootPath,SubDir,RootFile,i1_input,i2_input,j1_input,j2_input,FileExt,NomType]=fileparts_uvmat(fullfileinput);
     45
    4746
    4847%% check for particular file types: images, movies, civ data
     
    5857end
    5958
    60 if strcmp(NomType,'')||strcmp(NomType,'*')||strcmp(option,'filetype')
     59if strcmp(NomType,'')||strcmp(NomType,'*')
    6160    if exist(fullfileinput,'file')
    62       %  RootFile=fileinput;% case of constant name (no indexing)
    63         [tild,RootFile]=fileparts(fileinput);% case of constant name (no indexing)
     61        [tild,RootFile]=fileparts(fileinput);% case of constant name (no indexing), get the filename without its extension
    6462    else
    6563        RootFile='';
    6664    end
     65    i1_input=1;% the index now refer to the frame in the movie, choose 1 at opening
     66    i2_input=[];
     67    j1_input=[];
     68    j2_input=[];
    6769else
    6870    %% possibly include the first index in the root name, if there exists a corresponding xml file
    69     %   RootFileNew=RootFile;
    70     %     if ~isempty(regexp(NomType,['^_']))
    71     %         NomTypePref='_';
    72     %         RootFileNew=[RootFileNew '_'];
    73     %     end       RootPath='';
    7471    NomTypePref='';
    7572    r=regexp(NomType,'^(?<tiretnum>_?\d+)','names');%look for a number or _1 at the beginning of NomType
    76     %     r=regexp(NomType,['^' NomTypePref '(?<num1>\d+)'],'names');%look for a number at the beginning of NomTypeSt
    7773    if ~isempty(r)
    7874        fileinput_end=regexprep(fileinput,['^' RootFile],'');%remove RootFile at the beginning of fileinput
     
    8581            RootFileNew=[RootFile rr.i1];
    8682            checkpair=~isempty(regexp(NomType,'-','once'))||~isempty(regexp(NomType,'ab$','once'))||~isempty(regexp(NomType,'AB$','once'));%case of PIV results
    87             if exist(fullfile(RootPath,[RootFileNew '.xml']),'file') || (checkpair && exist(fullfile(fileparts(RootPath),[RootFileNew '.xml']),'file'))
     83            if exist(fullfile(RootPath,[RootFileNew '.xml']),'file') %|| (checkpair && exist(fullfile(fileparts(RootPath),[RootFileNew '.xml']),'file'))
    8884                RootFile=RootFileNew;
    8985                NomTypePref=r.tiretnum;
    9086                NomType=regexprep(NomType,['^'  NomTypePref],'');
     87                i1_input=j1_input;
    9188                i2_input=j2_input;
    9289                j1_input=[];
     
    151148    star_string=[RootFile sep1 i1_star i2_star  j1_star j2_star FileExt];
    152149    wd=pwd;%current working directory
    153     cd (RootPath)% move to the local dir to save time in the operation dir.
     150    cd (FilePath)% move to the local dir to save time in the operation dir.
    154151    dirpair=dir(star_string);% look for relevant files in the file directory
    155152    cd(wd)
     
    158155    ref_j_list=zeros(1,nbpair);
    159156    if nbpair==0% no detected file
    160         %         RootPath='';
    161157        RootFile='';
    162158    end
  • trunk/src/series.m

    r393 r398  
    957957ind_shift=0;%default
    958958
    959 %determine the list of input file names
    960 nbmissing=0;
    961 % for iview=1:length(RootPath)
    962 %     %case of pairs (.nc files)
    963 %     fileinput=name_generator(fullfile(RootPath{iview},RootFile{iview}),first_i,first_j,FileExt{iview},NomType{iview},1,first_i+1,first_j+1,SubDir{iview});
    964 %     if strcmp(get(handles.Pairs,'Visible'),'on')
    965 %        pair_list=get(handles.list_pair_civ,'String');
    966 %        val=get(handles.list_pair_civ,'Value');
    967 %        pair_string=pair_list{val};
    968 %        r=regexp(pair_string,'.*\D(?<num1>[\d+|*])(?<delim>[-||])(?<num2>[\d+|*])','names');
    969 %        if ~isempty(r)
    970 %            if strcmp(r.num1,'*')%free pairs
    971 %                [tild,RootFile,i1_series,i2_series,j1_series,j2_series,tild,tild,Object]=find_file_series(fileinput);% TODO: choice pair when multiple choice
    972 
    973 %                if isempty(i2_series) %j pairs
    974 %                    ind_sel=i1_series>=i1_series>=first_i & i1_series<=last_i & j1_series>first_j & j2_series<last_j;
    975 %                    j2_series=j2_series(ind_sel);
    976 %                else%i pairs
    977 %                    if isempty(j1_series) %j pairs
    978 %                         ind_sel=i1_series>=first_i & i2_series<=last_i ;
    979 %                    else
    980 %                        ind_sel=i1_series>=first_i & i2_series<=last_i& j1_series>first_j & j1_series<last_j;
    981 %                        j1_series=j1_series(ind_sel);
    982 %                        i2_series=i2_series(ind_sel);
    983 %                    end
    984 %                end
    985 %                i1_series=i1_series(ind_sel);             
    986 %            else
    987 %                if strcmp(r.delim,'-')
    988 %                    ind_shift(1)=str2num(r.num1);
    989 %                    ind_shift(2)=str2num(r.num2);
    990 %                else
    991 %                    ind_shift(1)=-str2num(r.num1);
    992 %                    ind_shift(2)=str2num(r.num2);
    993 %                end
    994 %                [i1_series,i2_series,j1_series,j2_series,nbmissing]=find_file_indices(num_i,num_j,ind_shift,NomType{iview},mode);
    995 %            end
    996 %        end
    997 %        if isempty(i1_series)
    998 %            msgbox_uvmat('ERROR','no file in the considered range')
    999 %            return
    1000 %        end
    1001 %        if isempty(i2_series)
    1002 %            i2_series=i1_series;
    1003 %        end
    1004 %        if isempty(j2_series)
    1005 %            j2_series=j1_series;
    1006 %        end
    1007 %     else%case of images
    1008 %         [i1_series,j1_series]=meshgrid(num_i,num_j);
    1009 %         i2_series=i1_series;
    1010 %         j2_series=j1_series;
    1011 %     end
    1012 %     if length(RootPath)>1
    1013 %         i1_series_cell{iview}=i1_series;
    1014 %         i2_series_cell{iview}=i2_series;
    1015 %         j1_series_cell{iview}=j1_series;
    1016 %         j2_series_cell{iview}=j2_series;
    1017 %     end
    1018 % end
    1019959
    1020960%% defining the ACTION function handle
     
    18291769%% look for min and max indices existing in the file series and update SeriesData
    18301770errormsg='';
    1831 [RootPathSub,FileName,FileExt]=fileparts(fileinput);
    1832 [RootFile,i1_series,i2_series,j1_series,j2_series,NomType,FileType,Object]=find_file_series(RootPathSub,[FileName FileExt]);
     1771[FilePath,FileName,FileExt]=fileparts(fileinput);
     1772% detect the file type, get the movie object if relevant, and look for the corresponding file series:
     1773% the root name and indices may be corrected by including the first index i1 if a corresponding xml file exists
     1774[RootPath,SubDir,RootFile,i1_series,i2_series,j1_series,j2_series,NomType,FileType,Object,i1,i2,j1,j2]=find_file_series(FilePath,[FileName FileExt]);
     1775
     1776%
     1777% [RootPathSub,FileName,FileExt]=fileparts(fileinput);
     1778% [RootFile,i1_series,i2_series,j1_series,j2_series,NomType,FileType,Object]=find_file_series(RootPathSub,[FileName FileExt]);
    18331779if isempty(RootFile)&&isempty(i1_series)
    18341780    errormsg='no input file in the series';
    18351781    return
    18361782end
    1837 [tild,tild,FileExt]=fileparts(fileinput);
     1783% [tild,tild,FileExt]=fileparts(fileinput);
    18381784
    18391785MinIndex=get(handles.MinIndex,'Data');
     
    19681914%%  read image documentation file  if found%%%%%%%%%%%%%%%%%%%%%%%%%%%
    19691915ext_imadoc='';
    1970 FileBase=fullfile(RootPathSub,RootFile);
     1916FileBase=fullfile(RootPath,RootFile);
    19711917if isequal(FileExt,'.xml')||isequal(FileExt,'.civ')
    19721918    ext_imadoc=FileExt;
  • trunk/src/uvmat.m

    r397 r398  
    504504
    505505%% detect root name, nomenclature and indices in the input file name:
    506 [RootPath,SubDir,tild,i1,i2,j1,j2]=fileparts_uvmat(fileinput);
    507 [tild,FileName,FileExt]=fileparts(fileinput);
     506%[RootPath,SubDir]=fileparts_uvmat(fileinput);
     507[FilePath,FileName,FileExt]=fileparts(fileinput);
    508508% detect the file type, get the movie object if relevant, and look for the corresponding file series:
    509 [RootFile,i1_series,i2_series,j1_series,j2_series,NomType,FileType,MovieObject]=find_file_series(fullfile(RootPath,SubDir),[FileName FileExt]);
    510 if strcmp(NomType,'*')% movies will be opened at the first frame
    511     i1=1;
    512     i2=[];
    513     j1=[];
    514     j2=[];
    515 end 
     509% the root name and indices may be corrected by including the first index i1 if a corresponding xml file exists
     510[RootPath,SubDir,RootFile,i1_series,i2_series,j1_series,j2_series,NomType,FileType,MovieObject,i1,i2,j1,j2]=find_file_series(FilePath,[FileName FileExt]);
     511% if strcmp(NomType,'*')% movies will be opened at the first frame
     512%     i1=1;
     513%     i2=[];
     514%     j1=[];
     515%     j2=[];
     516% end 
    516517
    517518%% open the file or fill the GUI uvmat according to the detected file type
     
    606607%fileinput=[fullfile(RootPath,SubDir,RootFile) FileIndices FileExt];
    607608% detect the file type, get the movie object if relevant, and look for the corresponding file series:
    608 [tild,i1_series,i2_series,j1_series,j2_series,tild,FileType,MovieObject]=find_file_series(fullfile(RootPath,SubDir),[RootFile FileIndices FileExt]);
     609[RootPath,SubDir,RootFile,i1_series,i2_series,j1_series,j2_series,tild,FileType,MovieObject]=find_file_series(fullfile(RootPath,SubDir),[RootFile FileIndices FileExt]);
    609610% initiate the input file series and refresh the current field view:
    610611update_rootinfo(handles,i1_series,i2_series,j1_series,j2_series,FileType,MovieObject);
     
    10921093%fileinput=[fullfile(RootPath,SubDir,RootFile) FileIndices FileExt];
    10931094% detect the file type, get the movie object if relevant, and look for the corresponding file series:
    1094 [tild,i1_series,i2_series,j1_series,j2_series,tild,FileType,MovieObject]=find_file_series(fullfile(RootPath,SubDir),[RootFile FileIndices FileExt]);
     1095[RootPath,SubDir,RootFile,i1_series,i2_series,j1_series,j2_series,tild,FileType,MovieObject]=find_file_series(fullfile(RootPath,SubDir),[RootFile FileIndices FileExt]);
    10951096% initiate the input file series and refresh the current field view:
    10961097update_rootinfo(handles,i1_series,i2_series,j1_series,j2_series,FileType,MovieObject,2);
     
    24462447for imap=1:numel(IndexObj)
    24472448    iobj=IndexObj(imap);
    2448     [ObjectData,errormsg]=proj_field(UvData.Field,UvData.Object{iobj})% project field on the object
     2449    [ObjectData,errormsg]=proj_field(UvData.Field,UvData.Object{iobj});% project field on the object
    24492450
    24502451    if ~isempty(errormsg)
Note: See TracChangeset for help on using the changeset viewer.