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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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
Note: See TracChangeset for help on using the changeset viewer.