Changeset 635 for trunk/src/series


Ignore:
Timestamp:
May 19, 2013, 11:37:49 PM (11 years ago)
Author:
sommeria
Message:
 
Location:
trunk/src/series
Files:
10 edited

Legend:

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

    r633 r635  
    9494nbfield_i=size(i1_series{1},2); %nb of fields for the i index
    9595nbfield=nbfield_j*nbfield_i; %total number of fields
    96 [first_i,tild,last_i,first_j,tild,last_j,errormsg]=get_index_range(Param.IndexRange);
    97 if ~isempty(errormsg),display(errormsg),return,end
    9896
    9997%% determine the file type on each line from the first input file
     
    140138elseif CheckNc{1}
    141139    FileExtOut='.nc';% write result as .nc files for netcdf inputs
    142 else 
     140else
    143141    msgbox_uvmat('ERROR',['invalid file type input ' FileType{1}])
    144142    return
    145143end
    146144if nbview==2 && ~isequal(CheckImage{1},CheckImage{2})
    147         msgbox_uvmat('ERROR','input must be two image series or two netcdf file series')
     145    msgbox_uvmat('ERROR','input must be two image series or two netcdf file series')
    148146    return
    149147end
    150 %NomTypeOut='_1-2_1';% output file index will indicate the first and last ref index in the series
     148
     149%% settings for the output file
    151150NomTypeOut=nomtype2pair(NomType{1});% determine the index nomenclature type for the output file
     151first_i=i1_series{1}(1);
     152last_i=i1_series{1}(end);
     153if isempty(j1_series{1})% if there is no second index j
     154    first_j=1;last_j=1;
     155else
     156    first_j=j1_series{1}(1);
     157    last_j=j1_series{1}(end);
     158end
    152159
    153160%% Set field names and velocity types
     
    177184for index=1:nbfield
    178185    update_waitbar(WaitbarHandle,index/nbfield)
    179     if ~isempty(RUNHandle)&& ishandle(RUNHandle) && ~strcmp(get(RUNHandle,'BusyAction'),'queue')
     186    if ~isempty(RUNHandle)&& ~strcmp(get(RUNHandle,'BusyAction'),'queue')
    180187        disp('program stopped by user')
    181188        break
     
    238245       
    239246        %%%%%%%%%%%% MAIN RUNNING OPERATIONS  %%%%%%%%%%%%
    240         %update sum
    241247        if nbfiles==1 %first field
    242248            time_1=[];
     
    255261                siz=size(Field.(VarName));
    256262                if ~isequal(DataOut.(VarName),0)&& ~isequal(siz,sizmean)
    257                     msgbox_uvmat('ERROR',['unequal size of input field ' VarName ', need to project  on a grid'])
     263                    displ_uvmat('ERROR',['unequal size of input field ' VarName ', need to project  on a grid'],checkrun)
    258264                    return
    259265                else
     
    285291    end
    286292else  % time from ImaDoc prevails if it exists
    287     %         j1=1;%default
    288     %         if ~isempty(j1_series{1})
    289     %             j1=j1_series{1};
    290     %         end
    291     %DataOut.Time=time(1,i1_series{1}(1),j1);
    292     %DataOut.Time_end=time(end,i1_series{end}(end),j1_series{end}(end));
    293293    DataOut.Time=time(1);
    294294    DataOut.Time_end=time(end);
  • trunk/src/series/check_data_files.m

    r626 r635  
    104104        Tabchar{2}='';
    105105        Tabchar{3}=[num2str(FileInfo.FrameRate) ' frames/s '];
     106        message='';
    106107        %         Tabchar{4}='';
    107108        %         Tabchar{5}=['  compression' FileInfo.VideoCompression];
  • trunk/src/series/civ_input.m

    r633 r635  
    195195%check_letter=~isempty(regexp(NomTypeIma,'[ab|AB]$'));%detect pair label by letter
    196196%if  isequal(NomTypeNc,'_1-2')||isempty(MaxIndex_j)|| (MaxIndex_j==1)
    197 MaxIndex_i=Param.IndexRange.MaxIndex_i{1};
    198 MaxIndex_j=Param.IndexRange.MaxIndex_j{1};
    199 MinIndex_i=Param.IndexRange.MinIndex_i{1};
    200 MinIndex_j=Param.IndexRange.MinIndex_j{1};
     197MaxIndex_i=Param.IndexRange.MaxIndex_i(1);
     198MinIndex_i=Param.IndexRange.MinIndex_i(1);
     199MaxIndex_j=1;%default
     200MinIndex_j=1;
     201if isfield(Param.IndexRange,'MaxIndex_j')&&isfield(Param.IndexRange,'MinIndex_j')
     202MaxIndex_j=Param.IndexRange.MaxIndex_j(1);
     203MinIndex_j=Param.IndexRange.MinIndex_j(1);
     204end
    201205CivInputData.MaxIndex_i=MaxIndex_i;
    202206CivInputData.MaxIndex_j=MaxIndex_j;
     
    211215        set(handles.ListPairMode,'Value',1)% advice 'pair j1-j2' except in MaxIndex_j is large
    212216    end
    213 elseif ~(strcmp(FileType,'video') || strcmp(FileType,'mmreader'))
     217%elseif ~(strcmp(FileType,'video') || strcmp(FileType,'mmreader'))
     218else
    214219    set(handles.ListPairMode,'String',{'pair j1-j2';'series(Dj)';'series(Di)'})%multiple choice
    215220    if strcmp(NomTypeNc,'_1-2_1')
     
    11311136Time=CivInputData.Time;
    11321137checkframe=strcmp(TimeUnit,'frame');
    1133 %displ_num=get(handles.ListPairCiv1,'UserData');
    1134 
    1135 %% eliminate the first pairs inconsistent with the position
    1136 % if isempty(displ_num)
    1137 %     nbpair=0;
    1138 % else
    1139 %     nbpair=length(displ_num(1,:));%nbre of displayed pairs
    1140 %     if  isequal(mode,'series(Di)')  %| isequal(mode,'st_series(Di)')
    1141 %         nbpair=min(2*ref_i-1,nbpair);%limit the number of pairs with positive first index
    1142 %     elseif  isequal(mode,'series(Dj)')% | isequal(mode,'st_series(Dj)')
    1143 %         nbpair=min(2*ref_j-1,nbpair);%limit the number of pairs with positive first index
    1144 %     end
    1145 % end
    1146 % nbpair=min(200,nbpair);%limit the number of displayed pairs to 200
    11471138
    11481139%% case with no Civ1 operation, netcdf files need to exist for reading
     
    12241215
    12251216%% determine the menu display in .ListPairCiv1
    1226 % the menu depends on the mode defined in ListPairMode_callback through the array displ_num:
    1227 % displ_num(1,:)=indices j1
    1228 % displ_num(2,:)=indices j2
    1229 % displ_num(3,:)=indices i1
    1230 % displ_num(4,:)=indices i2
    1231 % in mode 'pair j1-j2', j1 and j2 are the file indices, else the indices
    1232 % are relative to the reference indices ref_i and ref_j respectively.
    12331217testpair=0; %TODO: check
    12341218if isequal(mode,'series(Di)')
     
    12391223            if select(ipair)
    12401224                displ_pair{ipair}=['Di= ' num2str(-floor(ipair/2)) '|' num2str(ceil(ipair/2))];
    1241                 %if ~checkframe && size(Time,1)>=ref_i+1+displ_num(4,ipair) && size(Time,2)>=ref_j+1+displ_num(2,ipair)&&displ_num(2,ipair)>=1 &&displ_num(1,ipair)>=1
    1242                  %   dt=Time(ref_i+1+displ_num(4,ipair),ref_j+1+displ_num(2,ipair))-Time(ref_i+1+displ_num(3,ipair),ref_j+1+displ_num(1,ipair));%Time interval dt
    1243                if ~checkframe && size(Time,1)>=ref_i+1+ceil(ipair/2) && size(Time,2)>=ref_j+1&& ref_i-floor(ipair/2)>=0 && ref_j>=0
     1225               if ~checkframe
     1226                   if size(Time,1)>=ref_i+1+ceil(ipair/2) && size(Time,2)>=ref_j+1&& ref_i-floor(ipair/2)>=0 && ref_j>=0
    12441227                 dt=Time(ref_i+1+ceil(ipair/2),ref_j+1)-Time(ref_i+1-floor(ipair/2),ref_j+1);%Time interval dtref_j+1
     1228                 displ_pair{ipair}=[displ_pair{ipair} ' :dt= ' num2str(dt*1000)];
     1229                   end
    12451230                else
    1246                     dt=1;
    1247                 end
    1248                  displ_pair{ipair}=[displ_pair{ipair} ' :dt= ' num2str(dt*1000)];
     1231                    dt=ipair/1000;
     1232                      displ_pair{ipair}=[displ_pair{ipair} ' :dt= ' num2str(ipair)];
     1233               end             
    12491234            else
    12501235                displ_pair{ipair}='...'; %pair not displayed in the menu
     
    12591244            if select(ipair)
    12601245                displ_pair{ipair}=['Dj= ' num2str(-floor(ipair/2)) '|' num2str(ceil(ipair/2))];
    1261                 if ~checkframe && size(Time,1)>=ref_i+1+displ_num(4,ipair) && size(Time,2)>=ref_j+1+displ_num(2,ipair)
    1262                     dt=Time(ref_i+1+displ_num(4,ipair),ref_j+1+displ_num(2,ipair))-Time(ref_i+1+displ_num(3,ipair),ref_j+1+displ_num(1,ipair));%Time interval dt
     1246               if ~checkframe
     1247                   if size(Time,2)>=ref_j+1+ceil(ipair/2) && size(Time,1)>=ref_i+1 && ref_j-floor(ipair/2)>=0 && ref_i>=0
     1248                 dt=Time(ref_i+1,ref_j+1+ceil(ipair/2))-Time(ref_i+1,ref_j+1-floor(ipair/2));%Time interval dtref_j+1
     1249                  displ_pair{ipair}=[displ_pair{ipair} ' :dt= ' num2str(dt*1000)];
     1250                   end
     1251                else
     1252                    dt=ipair/1000;
    12631253                    displ_pair{ipair}=[displ_pair{ipair} ' :dt= ' num2str(dt*1000)];
    1264                 end
     1254               end                 
    12651255            else
    12661256                displ_pair{ipair}='...'; %pair not displayed in the menu
  • trunk/src/series/civ_series.m

    r633 r635  
    7979%% input files and indexing
    8080NbField=1;
    81 MaxIndex=cell2mat(Param.IndexRange.MaxIndex);
    82 MinIndex=cell2mat(Param.IndexRange.MinIndex);
     81MaxIndex_i=Param.IndexRange.MaxIndex_i;
     82MinIndex_i=Param.IndexRange.MinIndex_i;
     83MaxIndex_j=1;MinIndex_j=1;
     84if isfield(Param.IndexRange,'MaxIndex_j')&& isfield(Param.IndexRange,'MinIndex_j')
     85    MaxIndex_j=Param.IndexRange.MaxIndex_j;
     86    MinIndex_j=Param.IndexRange.MinIndex_j;
     87end
    8388if isfield(Param,'InputTable')
    8489    [filecell,i_series,tild,j_series]=get_file_series(Param);
     
    120125    if iview_B==0
    121126        FileType_B=FileType_A;
    122 VideoObject_B=VideoObject_A;
     127        VideoObject_B=VideoObject_A;
    123128        PairCiv1=Param.ActionInput.PairIndices.ListPairCiv1;
    124129        PairCiv2='';
     
    127132        end
    128133        [i1_series_Civ1,i2_series_Civ1,j1_series_Civ1,j2_series_Civ1,check_bounds,NomTypeNc]=...
    129             find_pair_indices(PairCiv1,i_series{1},j_series{1},MinIndex,MaxIndex);
     134            find_pair_indices(PairCiv1,i_series{1},j_series{1},MinIndex_i,MaxIndex_i,MinIndex_j,MaxIndex_j);
    130135        if ~isempty(PairCiv2)
    131136            [i1_series_Civ2,i2_series_Civ2,j1_series_Civ2,j2_series_Civ2,check_bounds_Civ2]=...
    132                 find_pair_indices(PairCiv2,i_series{1},j_series{1},MinIndex,MaxIndex);
     137                find_pair_indices(PairCiv2,i_series{1},j_series{1},MinIndex_i,MaxIndex_i,MinIndex_j,MaxIndex_j);
    133138            check_bounds=check_bounds | check_bounds_Civ2;
    134139        end
     
    158163        end
    159164    else
    160            [FileType_B,FileInfo,VideoObject_B]=get_file_type(filecell{2,1});
     165        [FileType_B,FileInfo,VideoObject_B]=get_file_type(filecell{2,1});
    161166        if isempty(find(strcmp(FileType_B,{'multimage','mmreader','video'})))
    162167            displ(['ERROR: the file line ' num2str(iview_B) ' must be an image'])
    163         end   
     168        end
    164169        %TODO : introduce the second file series if relevant: case %displacement
    165170    end
     
    217222%%%%% MAIN LOOP %%%%%%
    218223for ifield=1:NbField
    219     update_waitbar(WaitbarHandle,index/nbfield)
    220     if ~isempty(RUNHandle) && ishandle(RUNHandle) && ~strcmp(get(RUNHandle,'BusyAction'),'queue')
     224    update_waitbar(WaitbarHandle,ifield/NbField)
     225    if ~isempty(RUNHandle) && ~strcmp(get(RUNHandle,'BusyAction'),'queue')
    221226        disp('program stopped by user')
    222227        break
     
    264269            j2=j2_series_Civ1(ifield);
    265270        end
    266         Data.Civ1_Time=(time(i2+1,j2+1)+time(i1+1,j1+1))/2;
    267         Data.Civ1_Dt=time(i2+1,j2+1)-time(i1+1,j1+1);
     271        Data.Civ1_Time=(time(j2+1,i2+1)+time(j1+1,i1+1))/2;
     272        Data.Civ1_Dt=time(j2+1,i2+1)-time(j1+1,i1+1);
    268273        for ilist=1:length(list_param)
    269274            Data.(Civ1_param{4+ilist})=Param.ActionInput.Civ1.(list_param{ilist});
     
    400405        ImageName_A_Civ2=fullfile_uvmat(RootPath,SubDir,RootFile,FileExt,NomType,i1_series_Civ2(ifield),[],j1_series_Civ2(ifield));
    401406
    402         if strcmp(ImageName_A_Civ2,ImageName_A) && isequal(FrameIndex_A_Civ1(ifield),FrameIndex_A_Civ2)
     407        if strcmp(ImageName_A_Civ2,ImageName_A) && isequal(FrameIndex_A_Civ1(ifield),FrameIndex_A_Civ2(ifield))
    403408            par_civ2.ImageA=par_civ1.ImageA;
    404409        else
    405             [par_civ2.ImageA,VideoObject_A] = read_image(ImageName_A,FileType_A,VideoObject_A,FrameIndex_A_Civ2);
     410            [par_civ2.ImageA,VideoObject_A] = read_image(ImageName_A,FileType_A,VideoObject_A,FrameIndex_A_Civ2(ifield));
    406411        end
    407412        ImageName_B_Civ2=fullfile_uvmat(RootPath,SubDir,RootFile,FileExt,NomType,i2_series_Civ2(ifield),[],j2_series_Civ2(ifield));
     
    409414            par_civ2.ImageB=par_civ1.ImageB;
    410415        else
    411             [par_civ2.ImageB,VideoObject_B] = read_image(ImageName_B,FileType_B,VideoObject_B,FrameIndex_B_Civ2);
     416            [par_civ2.ImageB,VideoObject_B] = read_image(ImageName_B,FileType_B,VideoObject_B,FrameIndex_B_Civ2(ifield));
    412417        end     
    413418       
    414419        ncfile=fullfile_uvmat(RootPath,OutputDir,RootFile,'.nc',NomTypeNc,i1_series_Civ2(ifield),i2_series_Civ2(ifield),...
    415420            j1_series_Civ2(ifield),j2_series_Civ2(ifield));
    416         par_civ2.ImageWidth=FileInfo.Width;
    417         par_civ2.ImageHeight=FileInfo.Height;
     421        par_civ2.ImageWidth=FileInfo_A.Width;
     422        par_civ2.ImageHeight=FileInfo_A.Height;
    418423       
    419424        if isfield(par_civ2,'Grid')% grid points set as input file
     
    935940% --- determine the list of index pairs of processing file
    936941function [i1_series,i2_series,j1_series,j2_series,check_bounds,NomTypeNc]=...
    937     find_pair_indices(str_civ,i_series,j_series,MinIndex,MaxIndex)
     942    find_pair_indices(str_civ,i_series,j_series,MinIndex_i,MaxIndex_i,MinIndex_j,MaxIndex_j)
    938943%------------------------------------------------------------------------
    939944i1_series=i_series;% set of first image indexes
     
    973978    i1_series=i_series-ind1;% set of first image numbers
    974979    i2_series=i_series+ind2;
    975     check_bounds=i1_series<MinIndex(1,1) | i2_series>MaxIndex(1,1);
     980     check_bounds=i1_series<MinIndex_i | i2_series>MaxIndex_i;
    976981    if isempty(j_series)
    977982        NomTypeNc='_1-2';
     
    984989    j1_series=j_series-ind1;
    985990    j2_series=j_series+ind2;
    986     check_bounds=j1_series<MinIndex(1,2) | j2_series>MaxIndex(1,2);
     991    check_bounds=j1_series<MinIndex_j | j2_series>MaxIndex_j;
    987992    NomTypeNc='_1_1-2';
    988993else  %bursts
  • trunk/src/series/float_tracking.m

    r619 r635  
    115115nbfield_i=size(i1_series{1},2); %nb of fields for the i index
    116116nbfield=nbfield_j*nbfield_i; %total number of fields
    117 [first_i,tild,last_i,first_j,tild,last_j,errormsg]=get_index_range(Param.IndexRange);
    118 if ~isempty(errormsg),display(errormsg),return,end
    119117
    120118%% frame index for movie or multimage file input 
  • trunk/src/series/ima_levels.m

    r633 r635  
    151151for ifile=1:nbfield
    152152            update_waitbar(WaitbarHandle,ifile/nbfield)
    153     if ~isempty(RUNHandle) &&ishandle(RUNHandle) && ~strcmp(get(RUNHandle,'BusyAction'),'queue')
     153    if ~isempty(RUNHandle)&& ~strcmp(get(RUNHandle,'BusyAction'),'queue')
    154154        disp('program stopped by user')
    155155        return
  • trunk/src/series/merge_proj.m

    r633 r635  
    5151    ParamOut.TransformPath=fullfile(fileparts(which('uvmat')),'transform_field');% path to transform functions (needed for compilation only)
    5252    ParamOut.ProjObject='on';%can use projection object(option 'off'/'on',
    53     ParamOut.Mask='off';%can use mask option   (option 'off'/'on', 'off' by default)
     53    ParamOut.Mask='on';%can use mask option   (option 'off'/'on', 'off' by default)
    5454    ParamOut.OutputDirExt='.mproj';%set the output dir extension
    5555    ParamOut.OutputFileMode='NbInput';% '=NbInput': 1 output file per input file index, '=NbInput_i': 1 file per input file index i, '=NbSlice': 1 file per slice
     
    5858        msgbox_uvmat('WARNING','the first input file does not exist')
    5959    elseif isequal(size(Param.InputTable,1),1) && ~isfield(Param,'ProjObject')
    60         msgbox_uvmat('WARNING','a projection object of type plane needs to be introduced for merge_proj')
     60        msgbox_uvmat('WARNING','You may need a projection object of type plane for merge_proj')
    6161    end
    6262    return
  • trunk/src/series/particle_tracking.m

    r619 r635  
    115115nbfield_i=size(i1_series{1},2); %nb of fields for the i index
    116116nbfield=nbfield_j*nbfield_i; %total number of fields
    117 [first_i,tild,last_i,first_j,tild,last_j,errormsg]=get_index_range(Param.IndexRange);
    118 if ~isempty(errormsg),display(errormsg),return,end
    119117
    120118%% frame index for movie or multimage file input 
  • trunk/src/series/relabel_i_j.m

    r624 r635  
    226226for ifile=1:nbfield
    227227            update_waitbar(WaitbarHandle,ifile/nbfield)
    228     if ishandle(RUNHandle) && ~strcmp(get(RUNHandle,'BusyAction'),'queue')
     228    if ~isempty(RUNHandle) && ~strcmp(get(RUNHandle,'BusyAction'),'queue')
    229229        disp('program stopped by user')
    230230        break
  • trunk/src/series/time_series.m

    r633 r635  
    9898nbfield_i=size(i1_series{1},2); %nb of fields for the i index
    9999nbfield=nbfield_j*nbfield_i; %total number of fields
    100 [first_i,tild,last_i,first_j,tild,last_j,errormsg]=get_index_range(Param.IndexRange);
    101 if ~isempty(errormsg),display(errormsg),return,end
     100% [first_i,tild,last_i,first_j,tild,last_j,errormsg]=get_index_range(Param.IndexRange);
     101% if ~isempty(errormsg),display(errormsg),return,end
    102102
    103103%% determine the file type on each line from the first input file
     
    153153    return
    154154end
     155
     156%% settings for the output file
    155157NomTypeOut=nomtype2pair(NomType{1});% determine the index nomenclature type for the output file
     158first_i=i1_series{1}(1);
     159last_i=i1_series{1}(end);
     160if isempty(j1_series{1})% if there is no second index j
     161    first_j=1;last_j=1;
     162else
     163    first_j=j1_series{1}(1);
     164    last_j=j1_series{1}(end);
     165end
    156166
    157167%% Set field names and velocity types
     
    210220for index=1:nbfield
    211221            update_waitbar(WaitbarHandle,index/nbfield)
    212     if ~isempty(RUNHandle) &&ishandle(RUNHandle) && ~strcmp(get(RUNHandle,'BusyAction'),'queue')
     222    if ~isempty(RUNHandle) && ~strcmp(get(RUNHandle,'BusyAction'),'queue')
    213223        disp('program stopped by user')
    214224        break % leave the loop if stop is ordered
Note: See TracChangeset for help on using the changeset viewer.