Changeset 468 for trunk


Ignore:
Timestamp:
Jun 21, 2012, 9:37:02 PM (13 years ago)
Author:
sommeria
Message:

bug corrected in civ : reading time in case of xml file and avi
bugs corrrected in series

Location:
trunk/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/civ.m

    r467 r468  
    482482            if isfield(XmlData,'Heading')&&isfield(XmlData.Heading','ImageName')&&ischar(XmlData.Heading.ImageName)% get image nom type and extension from the xml file
    483483                %[PP,FF,fc,str2,str_a,str_b,ext_ima_read,nom_type_read]=name2display(XmlData.Heading.ImageName);
    484                 [tild,tild,tild,tild,tild,tild,tild,tild,nom_type_read]=fileparts_uvmat(XmlData.Heading.ImageName);
     484                [~,tild,tild,tild,tild,tild,tild,tild,nom_type_read]=fileparts_uvmat(XmlData.Heading.ImageName);
    485485                fullname=fullfile(fileparts(RootName),XmlData.Heading.ImageName); %full name (including path) of the first image defined by the xmle file,
    486486                if ~exist(fullname,'file')
     
    488488                end
    489489            end
    490             if isfield(XmlData,'Time')
     490            if isfield(XmlData,'Time') && ~isempty(XmlData.Time)
    491491                time=XmlData.Time;
    492492                %transform .Time to a column vector if it is a line vector thenomenclature uses a single index: correct possible bug in xml
     
    502502                TimeUnit=XmlData.TimeUnit;
    503503            end
    504 
     504           
    505505            if isfield(XmlData,'GeometryCalib')
    506506                tsai=XmlData.GeometryCalib;
    507                 if isfield(tsai,'fx_fy') 
    508                     pxcm_search=max(tsai.fx_fy(1),tsai.fx_fy(2));%pixels:cm estimated for the search range 
     507                if isfield(tsai,'fx_fy')
     508                    pxcm_search=max(tsai.fx_fy(1),tsai.fx_fy(2));%pixels:cm estimated for the search range
    509509                end
    510510                if isfield(tsai,'CoordUnit')
     
    518518            end
    519519            nom_type_ima='001a';
    520         case {'.avi','.AVI'}
    521             nom_type_ima='*';
    522             ImaExt=ext_imadoc;
    523             set(handles.ListPairMode,'Value',1);
    524             set(handles.ListPairMode,'String',{'series(Di)'})
    525             dt=0.04;%default
    526             if exist([RootName ext_imadoc],'file')==2
    527                 hhh=which('videoreader');
    528                 if isempty(hhh)%use old video function of matlab
    529                     imainfo=aviinfo([RootName ext_imadoc]);%read infos on the avi movie TO REPLACE mmreader
    530                     dt=1/imainfo.FramesPerSecond;%time interval between successive frames
    531                     MaxIndex_i=imainfo.NumFrames;%number of frames
    532                     %         XmlData.Time=(0:1/imainfo.FramesPerSecond:(imainfo.NumFrames-1)/imainfo.FramesPerSecond)';
    533                     %         nbfield=imainfo.NumFrames;
    534                     %         set(handles.Dt_txt,'String',['Dt=' num2str(1000/imainfo.FramesPerSecond) 'ms']);%display the elementary time interval in millisec
    535                     %         ColorType=imainfo.ImageType;%='truecolor' for color images
    536                 else %use video function videoreader of matlab
    537                     imainfo=get(videoreader([RootName ext_imadoc]));%read infos on the avi movie
    538                     dt=1/imainfo.FrameRate;%time interval between successive frames
    539                     MaxIndex_i=imainfo.NumberOfFrames;%number of frames
    540                     %         XmlData.Time=(0:1/imainfo.FrameRate:(imainfo.NumberOfFrames-1)/imainfo.FrameRate)';
    541                     %         nbfield=imainfo.NumberOfFrames;
    542                     %         set(handles.Dt_txt,'String',['Dt=' num2str(1000/imainfo.FrameRate) 'ms']);%display the elementary time interval in millisec
    543                     %         ColorType='truecolor';
    544                 end
    545                
    546                 time=(dt*(0:MaxIndex_i-1))';%list of image times
    547                 TimeUnit='s';
    548             end
    549             set(handles.ImaDoc,'BackgroundColor',[1 1 1])% set display box back to whiter
     520    end
     521    if isempty(time) && (strcmp(FileType,'video') || strcmp(FileType,'mmreader'))
     522        nom_type_ima='*';
     523        %ImaExt=ext_imadoc;
     524        set(handles.ListPairMode,'Value',1);
     525        set(handles.ListPairMode,'String',{'series(Di)'})
     526        dt=0.04;%default
     527        hhh=which('videoreader');
     528        if strcmp(FileType,'mmreader')%use old video function of matlab
     529            imainfo=aviinfo(fileinput);%read infos on the avi movie TO REPLACE mmreader
     530            dt=1/imainfo.FramesPerSecond;%time interval between successive frames
     531            MaxIndex_i=imainfo.NumFrames;%number of frames
     532        else %use video function videoreader of matlab
     533            imainfo=get(videoreader(fileinput));%read infos on the avi movie
     534            dt=1/imainfo.FrameRate;%time interval between successive frames
     535            MaxIndex_i=imainfo.NumberOfFrames;%number of frames
     536        end       
     537        time=(dt*(0:MaxIndex_i-1))';%list of image times
     538        TimeUnit='s';
     539        set(handles.ImaDoc,'BackgroundColor',[1 1 1])% set display box back to whiter
    550540    end
    551541end
  • trunk/src/find_file_series.m

    r456 r468  
    9393            RootFile_i=[RootFile rr.i1];
    9494           % checkpair=~isempty(regexp(NomType,'-','once'))||~isempty(regexp(NomType,'ab$','once'))||~isempty(regexp(NomType,'AB$','once'));%case of PIV results
    95             if exist(fullfile(RootPath,SubDir,[RootFile_i '.xml']),'file') %|| (checkpair && exist(fullfile(fileparts(RootPath),[RootFile_i '.xml']),'file'))
     95            if exist(fullfile(RootPath,SubDir,[RootFile_i '.xml']),'file') || exist(fullfile(RootPath,[RootFile_i '.xml']),'file')
    9696                RootFile=RootFile_i;
    9797                NomTypePref=r.tiretnum;
  • trunk/src/series.m

    r463 r468  
    683683if ~isempty(time)
    684684TimeTable=get(handles.TimeTable,'Data');
     685first_i=str2num(get(handles.num_first_i,'String'));
     686last_i=str2num(get(handles.num_last_i,'String'));
     687first_j=str2num(get(handles.num_first_i,'String'));
     688last_j=str2num(get(handles.num_last_i,'String'));
     689MinIndexTable=get(handles.MinIndex,'Data');
     690MinIndex_i=MinIndexTable{iview,1};
     691MinIndex_j=MinIndexTable{iview,2};
     692MaxIndexTable=get(handles.MaxIndex,'Data');
     693MaxIndex_i=MaxIndexTable{iview,1};
     694MaxIndex_j=MaxIndexTable{iview,2};
    685695if isempty(MinIndex_j)
    686696    if MinIndex_i>0
Note: See TracChangeset for help on using the changeset viewer.