Changeset 435 for trunk/src/civ.m


Ignore:
Timestamp:
May 31, 2012, 8:21:06 AM (12 years ago)
Author:
sommeria
Message:

civ improved to deal with movies. Introduction of a file type mmreader needed for Matlab 2009 (Videoreader not available)

Location:
trunk/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src

    • Property svn:ignore
      •  

        old new  
        44XML_SCHEMAS
        55bin
         6check_files.m
        67toolbox_calib
        78uvmat_doc
  • trunk/src/civ.m

    r427 r435  
     1
    12%'civ': function associated with the interface 'civ.fig' for PIV, spline interpolation and stereo PIV (patch)
    23%------------------------------------------------------------------------
     
    6364        t=xmltree(xmlfile);
    6465        sparam=convert(t);
    65     catch
    66         errormsg={' Unable to read the file PARAM.xml defining the civx binaries:'; lasterr};
     66    catch ME
     67        errormsg={' Unable to read the file PARAM.xml defining the civx binaries:';ME.message};
    6768    end
    6869else
     
    409410% end
    410411switch FileType
    411     case {'image','multimage','video'}
     412    case {'image','multimage','video','mmreader'}
    412413    otherwise
    413414        errormsg='invalid input file: enter an image, a movie or civ .nc file';
     
    10591060
    10601061
    1061 %------------------------------------------------------------------------
     1062%--------------orm----------------------------------------------------------
    10621063% --- Main lauch command, called by RUN and BATCH
    10631064function errormsg=launch_jobs(hObject, eventdata, handles, batch)
     
    12271228if ~strcmp(CivMode,'CivX')
    12281229    if Param.CheckCiv1
    1229     [Param.Civ1.FileTypeA,FileInfo,Param.Civ1.ImageA]=get_file_type(filecell.ima1.civ1{1});
    1230     [Param.Civ1.FileTypeB,FileInfo,Param.Civ1.ImageB]=get_file_type(filecell.ima2.civ1{1});
     1230        [Param.Civ1.FileTypeA,FileInfo,Param.Civ1.ImageA]=get_file_type(filecell.ima1.civ1{1});
     1231        [Param.Civ1.FileTypeB,FileInfo,Param.Civ1.ImageB]=get_file_type(filecell.ima2.civ1{1});
    12311232    end
    12321233    if Param.CheckCiv2
    1233     [Param.Civ2.FileTypeA,FileInfo,Param.Civ2.ImageA]=get_file_type(filecell.ima1.civ2{1});
    1234     [Param.Civ2.FileTypeB,FileInfo,Param.Civ2.ImageB]=get_file_type(filecell.ima2.civ2{1});
     1234        [Param.Civ2.FileTypeA,FileInfo,Param.Civ2.ImageA]=get_file_type(filecell.ima1.civ2{1});
     1235        [Param.Civ2.FileTypeB,FileInfo,Param.Civ2.ImageB]=get_file_type(filecell.ima2.civ2{1});
    12351236    end
    12361237end
     
    12711272        if Param.CheckCiv1
    12721273            % read image-dependent parameters
    1273             Param.Civ1.ImageA=filecell.ima1.civ1{ifile,j};
    1274             Param.Civ1.ImageB=filecell.ima2.civ1{ifile,j};
     1274           
    12751275            if ~checkframe% && size(time,1)>=i2_civ1(ifile) && size(time,2)>=j2_civ1(j)
    12761276                Param.Civ1.Dt=(time(i2_civ1(ifile)+1,j2_civ1(j)+1)-time(i1_civ1(ifile)+1,j1_civ1(j)+1));
     
    12801280            Param.Civ1.Time=((time(i2_civ1(ifile)+1,j2_civ1(j)+1)+time(i1_civ1(ifile)+1,j1_civ1(j)+1))/2);
    12811281            if strcmp(CivMode,'CivX')
    1282             Param.Civ1.term_a=num2stra(j1_civ1(j),nom_type_nc);%UTILITE?
    1283             Param.Civ1.term_b=num2stra(j2_civ1(j),nom_type_nc);%
    1284             end
    1285             form=imformats(regexprep(get(handles.ImaExt,'String'),'^.',''));%look for image formats
    1286             if isempty(form)
    1287                 ImageInfo=get(VideoReader(filecell.ima1.civ1{1,1}));
     1282                Param.Civ1.term_a=num2stra(j1_civ1(j),nom_type_nc);%UTILITE?
     1283                Param.Civ1.term_b=num2stra(j2_civ1(j),nom_type_nc);%
     1284            end
     1285            if strcmp(Param.Civ1.FileTypeA,'video')|| strcmp(Param.Civ1.FileTypeA,'mmreader')
     1286                %   ImageInfo=get(VideoReader(fullfile(Param.RootPath,[Param.RootFile Param.ImaExt])));
     1287                ImageInfo=get(Param.Civ1.ImageA);
     1288                %                 elseif strcmp(Param.Civ1.FileTypeA,'mmreader')
     1289                %                     ImageInfo=get(mmreader(fullfile(Param.RootPath,[Param.RootFile Param.ImaExt])));
    12881290                Param.Civ1.ImageBitDepth=ImageInfo.BitsPerPixel/3;
     1291                if batch
     1292                    Param.Civ1.ImageA=filecell.ima1.civ1{ifile,j};%file name must be used for batch instead of video object
     1293                    Param.Civ1.ImageB=filecell.ima2.civ1{ifile,j};
     1294                end
    12891295            else
     1296                Param.Civ1.ImageA=filecell.ima1.civ1{ifile,j};
     1297                Param.Civ1.ImageB=filecell.ima2.civ1{ifile,j};
     1298                form=imformats(regexprep(get(handles.ImaExt,'String'),'^.',''));%look for image formats
    12901299                ImageInfo=imfinfo(filecell.ima1.civ1{1,1});%read the first image to get the size
    12911300                Param.Civ1.ImageBitDepth=ImageInfo.BitDepth;
    12921301            end
     1302           
    12931303            Param.Civ1.ImageWidth=ImageInfo.Width;
    12941304            Param.Civ1.ImageHeight=ImageInfo.Height;
    1295             Param.Civ1.i1=i1_civ1(ifile);
    1296             Param.Civ1.i2=i2_civ1(ifile);
    1297             % read mask parameters
     1305            Param.Civ1.FrameIndexA=i1_civ1(ifile);
     1306            Param.Civ1.FrameIndexB=i2_civ1(ifile);
     1307            % read mask )parameters
    12981308            if Param.Civ1.CheckMask % the lines below should be changed with the new gui
    12991309                if ~exist(Param.Civ1.Mask,'file')
     
    13121322                        i1_grid=mod(i1_civ1(ifile)-1,nbslice_grid)+1;
    13131323                        Param.Civ1.Grid=[filecell.filebase '_' fullfile_uvmat('','',Param.Civ1.Grid,'.grid','_1',i1_grid)];
    1314 %                         Param.Civ1.Grid=[filecell.filebase '_' name_generator(Param.Civ1.Grid,i1_grid,1,'.grid','_i')];
     1324                        %                         Param.Civ1.Grid=[filecell.filebase '_' name_generator(Param.Civ1.Grid,i1_grid,1,'.grid','_i')];
    13151325                        if ~exist(Param.Civ1.GridName,'file')
    13161326                            errormsg='grid file absent for civ1';
     
    14241434        end
    14251435        if Param.CheckCiv2==1
    1426             Param.Civ2.ImageA=filecell.ima1.civ2{ifile,j};
    1427             Param.Civ2.ImageB=filecell.ima2.civ2{ifile,j};
     1436            if strcmp(Param.Civ2.FileTypeA,'video')|| strcmp(Param.Civ2.FileTypeA,'mmreader')
     1437                %   ImageInfo=get(VideoReader(fullfile(Param.RootPath,[Param.RootFile Param.ImaExt])));
     1438                ImageInfo=get(Param.Civ2.ImageA);
     1439                %                 elseif strcmp(Param.Civ1.FileTypeA,'mmreader')
     1440                %                     ImageInfo=get(mmreader(fullfile(Param.RootPath,[Param.RootFile Param.ImaExt])));
     1441                Param.Civ2.ImageBitDepth=ImageInfo.BitsPerPixel/3;
     1442                if batch
     1443                    Param.Civ2.ImageA=filecell.ima1.civ2{ifile,j};%file name must be used for batch instead of video object
     1444                    Param.Civ2.ImageB=filecell.ima2.civ2{ifile,j};
     1445                end
     1446            else
     1447                Param.Civ2.ImageA=filecell.ima1.civ2{ifile,j};
     1448                Param.Civ2.ImageB=filecell.ima2.civ2{ifile,j};
     1449                form=imformats(regexprep(get(handles.ImaExt,'String'),'^.',''));%look for image formats
     1450                ImageInfo=imfinfo(filecell.ima1.civ2{1,1});%read the first image to get the size
     1451                Param.Civ2.ImageBitDepth=ImageInfo.BitDepth;
     1452            end
     1453           
    14281454            if ~checkframe %&& size(time,1)>=i2_civ2(ifile) && size(time,2)>=j2_civ2(j)
    14291455                Param.Civ2.Dt=time(i2_civ2(ifile)+1,j2_civ2(j)+1)-time(i1_civ2(ifile)+1,j1_civ2(j)+1);
     
    14631489            form=imformats(regexprep(get(handles.ImaExt,'String'),'^.',''));%look for image formats
    14641490            if isempty(form)
    1465                 ImageInfo=get(VideoReader(filecell.ima1.civ2{1,1}));
     1491               % ImageInfo=get(VideoReader(fullfile());
    14661492                Param.Civ2.ImageBitDepth=ImageInfo.BitsPerPixel/3;
    14671493            else
     
    14711497            Param.Civ2.ImageWidth=ImageInfo.Width;
    14721498            Param.Civ2.ImageHeight=ImageInfo.Height;
    1473             Param.Civ2.i1=i1_civ2(ifile);
    1474             Param.Civ2.i2=i2_civ2(ifile);
     1499            Param.Civ2.FrameIndexA=i1_civ2(ifile);
     1500             Param.Civ2.FrameIndexB=i2_civ2(ifile);
     1501%             Param.Civ2.i1=i1_civ2(ifile);
     1502%             Param.Civ2.i2=i2_civ2(ifile);
    14751503            switch CivMode
    14761504                case 'CivX'
     
    40004028    par_civ1.ImageHeight=size(Data.A,1);
    40014029    par_civ1.Mask='all';% will provide only the grid set for PIV, no image correlation
    4002     par_civ1.i1=i1;
    4003     par_civ1.i2=i2;
     4030    par_civ1.FrameIndexA=num2str(i1);
     4031    par_civ1.FrameIndexB=num2str(i2);
    40044032    Param.Civ1=par_civ1;
    40054033    Grid=civ_matlab(Param);% get the grid of x, y positions set for PIV
Note: See TracChangeset for help on using the changeset viewer.