Changeset 819 for trunk


Ignore:
Timestamp:
Oct 8, 2014, 8:27:12 PM (7 years ago)
Author:
sommeria
Message:

new

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/series/civ_series.m

    r810 r819  
    2121%     .Patch2:
    2222% ncfile: name of a netcdf file to be created for the result (extension .nc)
    23 
    24 %=======================================================================
    25 % Copyright 2008-2014, LEGI UMR 5519 / CNRS UJF G-INP, Grenoble, France
    26 %   http://www.legi.grenoble-inp.fr
    27 %   Joel.Sommeria - Joel.Sommeria (A) legi.cnrs.fr
    2823%
    29 %     This file is part of the toolbox UVMAT.
    30 %
     24%AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
     25%  Copyright 2011-2014, LEGI / CNRS UJF G-INP, Joel.Sommeria@legi.grenoble-inp.fr
     26%AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
     27%     This is part of the toolbox UVMAT.
     28%
    3129%     UVMAT is free software; you can redistribute it and/or modify
    32 %     it under the terms of the GNU General Public License as published
    33 %     by the Free Software Foundation; either version 2 of the license,
    34 %     or (at your option) any later version.
    35 %
     30%     it under the terms of the GNU General Public License as published by
     31%     the Free Software Foundation; either version 2 of the License, or
     32%     (at your option) any later version.
     33% 
    3634%     UVMAT is distributed in the hope that it will be useful,
    3735%     but WITHOUT ANY WARRANTY; without even the implied warranty of
    3836%     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    39 %     GNU General Public License (see LICENSE.txt) for more details.
    40 %=======================================================================
     37%     GNU General Public License (open UVMAT/COPYING.txt) for more details.
     38%AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
    4139
    4240function [Data,errormsg,result_conv]= civ_series(Param)
     
    8078if ischar(Param)
    8179    Param=xml2struct(Param);% read Param as input file (batch case)
     80    Param.InputTable{1}
     81    Param.InputTable{2}
     82     Param.InputTable{3}
    8283    checkrun=0;
    8384end
     
    228229            [DataIn,tild,tild,errormsg]=nc2struct(ImageName_A,{FieldName_A});
    229230            par_civ1.ImageA=DataIn.(FieldName_A);
    230         else         
    231         [par_civ1.ImageA,VideoObject_A] = read_image(ImageName_A,FileType_A,VideoObject_A,FrameIndex_A_Civ1(1));
     231        else
     232            [par_civ1.ImageA,VideoObject_A] = read_image(ImageName_A,FileType_A,VideoObject_A,FrameIndex_A_Civ1(1));
    232233        end
    233234        ImageName_B=fullfile_uvmat(RootPath_B,SubDir_B,RootFile_B,FileExt_B,NomType_B,i2_series_Civ1(1),[],j2_series_Civ1(1));
     
    240241        if strcmp(FileInfo_B.FileType,'netcdf')
    241242            FieldName_B=Param.InputFields.FieldName;
    242              [DataIn,tild,tild,errormsg]=nc2struct(ImageName_B,{FieldName_B});
    243              par_civ1.ImageB=DataIn.(FieldName_B);
    244         else
    245         [par_civ1.ImageB,VideoObject_B] = read_image(ImageName_B,FileType_B,VideoObject_B,FrameIndex_B_Civ1(1));
     243            [DataIn,tild,tild,errormsg]=nc2struct(ImageName_B,{FieldName_B});
     244            par_civ1.ImageB=DataIn.(FieldName_B);
     245        else
     246            [par_civ1.ImageB,VideoObject_B] = read_image(ImageName_B,FileType_B,VideoObject_B,FrameIndex_B_Civ1(1));
    246247        end
    247248        NbField=numel(i1_series_Civ1);
     
    531532        par_civ2.ImageB=[];
    532533        %         if ~isfield(Param.Civ1,'ImageA')
    533         ImageName_A_Civ2=fullfile_uvmat(RootPath_A,SubDir_A,RootFile_A,FileExt_A,NomType_A,i1_series_Civ2(ifield),[],j1_series_Civ2(ifield));
     534         i1=i1_series_Civ2(ifield);
     535        i2=i1;
     536        if ~isempty(i2_series_Civ2)
     537            i2=i2_series_Civ2(ifield);
     538        end
     539        j1=1;
     540        if ~isempty(j1_series_Civ2)
     541            j1=j1_series_Civ2(ifield);
     542        end
     543        j2=j1;
     544        if ~isempty(j2_series_Civ2)
     545            j2=j2_series_Civ2(ifield);
     546        end
     547        ImageName_A_Civ2=fullfile_uvmat(RootPath_A,SubDir_A,RootFile_A,FileExt_A,NomType_A,i1,[],j1);
    534548
    535549        if strcmp(ImageName_A_Civ2,ImageName_A) && isequal(FrameIndex_A_Civ1(ifield),FrameIndex_A_Civ2(ifield))
     
    538552            [par_civ2.ImageA,VideoObject_A] = read_image(ImageName_A_Civ2,FileType_A,VideoObject_A,FrameIndex_A_Civ2(ifield));
    539553        end
    540         ImageName_B_Civ2=fullfile_uvmat(RootPath_B,SubDir_B,RootFile_B,FileExt_B,NomType_B,i2_series_Civ2(ifield),[],j2_series_Civ2(ifield));
     554        ImageName_B_Civ2=fullfile_uvmat(RootPath_B,SubDir_B,RootFile_B,FileExt_B,NomType_B,i2,[],j2);
    541555        if strcmp(ImageName_B_Civ2,ImageName_B) && isequal(FrameIndex_B_Civ1(ifield),FrameIndex_B_Civ2)
    542556            par_civ2.ImageB=par_civ1.ImageB;
     
    545559        end     
    546560       
    547         ncfile=fullfile_uvmat(RootPath_A,OutputDir,RootFile_A,'.nc',NomTypeNc,i1_series_Civ2(ifield),i2_series_Civ2(ifield),...
    548             j1_series_Civ2(ifield),j2_series_Civ2(ifield));
     561        ncfile=fullfile_uvmat(RootPath_A,OutputDir,RootFile_A,'.nc',NomTypeNc,i1,i2,...
     562            j1,j2);
    549563        par_civ2.ImageWidth=FileInfo_A.Width;
    550564        par_civ2.ImageHeight=FileInfo_A.Height;
     
    601615        par_civ2.SearchBoxSize(1)=2*ibx2+9;% search ara +-4 pixels around the guess
    602616        par_civ2.SearchBoxSize(2)=2*iby2+9;
    603         i1=i1_series_Civ2(ifield);
    604         i2=i1;
    605         if ~isempty(i2_series_Civ2)
    606             i2=i2_series_Civ2(ifield);
    607         end
    608         j1=1;
    609         if ~isempty(j1_series_Civ2)
    610             j1=j1_series_Civ2(ifield);
    611         end
    612         j2=j1;
    613         if ~isempty(j2_series_Civ1)
    614             j2=j2_series_Civ2(ifield);
    615         end
     617%         i1=i1_series_Civ2(ifield);
     618%         i2=i1;
     619%         if ~isempty(i2_series_Civ2)
     620%             i2=i2_series_Civ2(ifield);
     621%         end
     622%         j1=1;
     623%         if ~isempty(j1_series_Civ2)
     624%             j1=j1_series_Civ2(ifield);
     625%         end
     626%         j2=j1;
     627%         if ~isempty(j2_series_Civ1)
     628%             j2=j2_series_Civ2(ifield);
     629%         end
    616630        Civ2_Dt=time(i2+1,j2+1)-time(i1+1,j1+1);
    617631        par_civ2.SearchBoxShift=(Civ2_Dt/Data.Civ1_Dt)*[Shiftx(nbval>=1)./nbval(nbval>=1) Shifty(nbval>=1)./nbval(nbval>=1)];
     
    10881102i1_series=i_series;% set of first image indexes
    10891103i2_series=i_series;
    1090 j1_series=ones(size(i_series));% set of first image numbers
    1091 j2_series=ones(size(i_series));
     1104j1_series=j_series;%ones(size(i_series));% set of first image numbers
     1105j2_series=j_series;%ones(size(i_series));
    10921106r=regexp(str_civ,'^\D(?<ind>[i|j])=( -| )(?<num1>\d+)\|(?<num2>\d+)','names');
    10931107if ~isempty(r)
     
    11181132    end
    11191133end
    1120 if strcmp (mode,'Di')
    1121     i1_series=i_series-ind1;% set of first image numbers
    1122     i2_series=i_series+ind2;
    1123      check_bounds=i1_series<MinIndex_i | i2_series>MaxIndex_i;
    1124     if isempty(j_series)
    1125         NomTypeNc='_1-2';
    1126     else
    1127         j1_series=j_series;
    1128         j2_series=j_series;
    1129         NomTypeNc='_1-2_1';
    1130     end
    1131 elseif strcmp (mode,'Dj')
    1132     j1_series=j_series-ind1;
    1133     j2_series=j_series+ind2;
    1134     check_bounds=j1_series<MinIndex_j | j2_series>MaxIndex_j;
    1135     NomTypeNc='_1_1-2';
    1136 else  %bursts
    1137     i1_series=i_series(1,:);% do not sweep the j index
    1138     i2_series=i_series(1,:);
    1139     j1_series=ind1*ones(1,size(i_series,2));% j index is fixed by pair choice
    1140     j2_series=ind2*ones(1,size(i_series,2));
    1141     check_bounds=zeros(size(i1_series));% no limitations due to min-max indices
    1142 end
    1143 
    1144 
    1145 
    1146 
     1134switch mode
     1135    case 'Di'
     1136        i1_series=i_series-ind1;% set of first image numbers
     1137        i2_series=i_series+ind2;
     1138        check_bounds=i1_series<MinIndex_i | i2_series>MaxIndex_i;
     1139        if isempty(j_series)
     1140            NomTypeNc='_1-2';
     1141        else
     1142            j1_series=j_series;
     1143            j2_series=j_series;
     1144            NomTypeNc='_1-2_1';
     1145        end
     1146    case 'Dj'
     1147        j1_series=j_series-ind1;
     1148        j2_series=j_series+ind2;
     1149        check_bounds=j1_series<MinIndex_j | j2_series>MaxIndex_j;
     1150        NomTypeNc='_1_1-2';
     1151    otherwise %bursts
     1152        i1_series=i_series(1,:);% do not sweep the j index
     1153        i2_series=i_series(1,:);
     1154        j1_series=ind1*ones(1,size(i_series,2));% j index is fixed by pair choice
     1155        j2_series=ind2*ones(1,size(i_series,2));
     1156        check_bounds=zeros(size(i1_series));% no limitations due to min-max indices
     1157end
     1158
     1159
     1160
     1161
Note: See TracChangeset for help on using the changeset viewer.