Ignore:
Timestamp:
Apr 7, 2013, 10:14:45 AM (8 years ago)
Author:
sommeria
Message:

bug on compilation solved (still to test with transform_field fct). faster browser inrtroduced. Various bug corrections

File:
1 edited

Legend:

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

    r605 r606  
    4242path_series=fileparts(which('series'));
    4343addpath(fullfile(path_series,'series'))
    44 %% set the input elements needed on the GUI series when the action is selected in the menu ActionName
     44%% set the input elements needed on the GUI series when the action is selected in the menu ActionName or InputTable refreshed
    4545if isstruct(Param) && isequal(Param.Action.RUN,0)
    4646    Data=civ_input(Param);% introduce the civ parameters using the GUI civ_input
    47     Data.Program=mfilename;
    48     Data.AllowInputSort='off';...% allow alphabetic sorting of the list of input file SubDir (options 'off'/'on', 'off' by default)
    49         Data.WholeIndexRange='off';...% prescribes the file index ranges from min to max (options 'off'/'on', 'off' by default)
    50         Data.NbSlice='off'; ...%nbre of slices ('off' by default)
    51         Data.VelType='off';...% menu for selecting the velocity type (options 'off'/'one'/'two',  'off' by default)
    52         Data.FieldName='off';...% menu for selecting the field (s) in the input file(options 'off'/'one'/'two', 'off' by default)
    53         Data.FieldTransform = 'off';...%can use a transform function
    54         Data.ProjObject='off';...%can use projection object(option 'off'/'on',
    55         Data.Mask='off';...%can use mask option   (option 'off'/'on', 'off' by default)
    56         Data.OutputDirExt='.civ';%set the output dir extension
    57        
     47    Data.Program=mfilename;%gives the name of the current function
     48    Data.AllowInputSort='off';% allow alphabetic sorting of the list of input file SubDir (options 'off'/'on', 'off' by default)
     49    Data.WholeIndexRange='off';% prescribes the file index ranges from min to max (options 'off'/'on', 'off' by default)
     50    Data.NbSlice='off'; %nbre of slices ('off' by default)
     51    Data.VelType='off';% menu for selecting the velocity type (options 'off'/'one'/'two',  'off' by default)
     52    Data.FieldName='off';% menu for selecting the field (s) in the input file(options 'off'/'one'/'two', 'off' by default)
     53    Data.FieldTransform = 'off';%can use a transform function
     54    Data.ProjObject='off';%can use projection object(option 'off'/'on',
     55    Data.Mask='off';%can use mask option   (option 'off'/'on', 'off' by default)
     56    Data.OutputDirExt='.civ';%set the output dir extension
     57    filecell=get_file_series(Param);%check existence of the first input file
     58    if ~exist(filecell{1,1},'file')
     59        msgbox_uvmat('WARNING','the first input file does not exist')
     60    end
    5861    return
    5962end
     
    115118   
    116119    NbField=numel(i1_series_Civ1);
    117     ImageTypeOptions={'image','multimage','mmreader','video'};
    118120    [FileType_A,FileInfo,MovieObject_A]=get_file_type(filecell{1,1});
    119121    FileType_B=FileType_A;
     
    121123    if size(filecell,1)>=2 && ~strcmp(filecell{1,1},filecell{2,1})
    122124        [FileType_B,FileInfo,MovieObject_B]=get_file_type(filecell{2,1});
    123         CheckImage_B=~isempty(find(strcmp(FileType,ImageTypeOptions)));% =1 for images
    124125    end
    125126end
     
    141142check_patch1=0;%default
    142143
    143 
    144 
    145 
    146 
     144%% get timing from the ImaDoc file or input video
     145[XmlData,NbSlice_calib,time,errormsg]=read_multimadoc(RootPath,SubDir,RootFile,FileExt,i1_series,i2_series,j1_series,j2_series);
     146%TODO: get time_A and time_B
     147% case of movies TODO TODO TODO
     148if isempty(time) && (strcmp(FileType,'video') || strcmp(FileType,'mmreader'))
     149    set(handles.ListPairMode,'Value',1);
     150    dt=1/get(MovieObject,'FrameRate');%time interval between successive frames
     151    if strcmp(NomTypeIma,'*')
     152        set(handles.ListPairMode,'String',{'series(Di)'})
     153        MaxIndex_i=get(MovieObject,'NumberOfFrames');
     154        time=(dt*(0:MaxIndex_i-1))';%list of image times
     155    else
     156        set(handles.ListPairMode,'String',[{'series(Dj)'};{'series(Di)'}])
     157        MaxIndex_i=max(i1_series(i1_series>0));
     158        MaxIndex_j=get(MovieObject,'NumberOfFrames');
     159        time=ones(MaxIndex_i,1)*(dt*(0:MaxIndex_j-1));%list of image times
     160        enable_j(handles,'on')
     161    end
     162    TimeUnit='s';
    147163%%%%% MAIN LOOP %%%%%%
    148164
     
    164180            end
    165181        else
    166             %         if ~isfield(Param.Civ1,'ImageA')
    167182            ImageName_A=fullfile_uvmat(RootPath,SubDir,RootFile,FileExt,NomType,i1_series_Civ1(ifield),[],j1_series_Civ1(ifield));
    168183            [par_civ1.ImageA,MovieObject_A] = read_image(ImageName_A,FileType_A,MovieObject_A,FrameIndex_A_Civ1(ifield));
    169             %         elseif ischar(Param.Civ1.ImageA)
    170             %             Param.Civ1.ImageA=regexprep(Param.Civ1.ImageA,'''','\');
    171             %             [par_civ1.ImageA,VideoObject] = read_image(Param.Civ1.ImageA,par_civ1.FileTypeA,MovieObject_A,par_civ1.FrameIndexA);
    172             %         end
    173             %         if ~isfield(Param.Civ1,'ImageB')
    174184            ImageName_B=fullfile_uvmat(RootPath,SubDir,RootFile,FileExt,NomType,i2_series_Civ1(ifield),[],j2_series_Civ1(ifield));
    175185            [par_civ1.ImageB,MovieObject_B] = read_image(ImageName_B,FileType_B,MovieObject_B,FrameIndex_B_Civ1(ifield));
    176             %         elseif isfield(Param.Civ1,'ImageB')&& ischar(Param.Civ1.ImageB)
    177             %              Param.Civ1.ImageB=regexprep(Param.Civ1.ImageB,'''','\');
    178             %              if strcmp(Param.Civ1.ImageA,Param.Civ1.ImageB)% use the same movie object
    179             %                  [par_civ1.ImageB,VideoObject] = read_image(Param.Civ1.ImageB,par_civ1.FileTypeB,VideoObject,par_civ1.FrameIndexB);
    180             %              else
    181             %             [par_civ1.ImageB,VideoObject] = read_image(Param.Civ1.ImageB,par_civ1.FileTypeB,par_civ1.ImageB,par_civ1.FrameIndexB);
    182             %              end
    183             %         end
    184186        end
    185187        ncfile=fullfile_uvmat(RootPath,OutputDir,RootFile,'.nc',NomTypeNc,i1_series_Civ1(ifield),i2_series_Civ1(ifield),...
     
    188190        par_civ1.ImageHeight=FileInfo.Height;
    189191        list_param=(fieldnames(Param.ActionInput.Civ1))';
    190         Civ1_param=list_param;%default
    191        
    192         %set the values of all the global attributes in list_param 
     192        Civ1_param=regexprep(list_param,'^.+','Civ1_$0');% insert 'Civ1_' before  each string in list_param
     193        Civ1_param=[{'Civ1_ImageA','Civ1_ImageB','Civ1_Time','Civ1_Dt'} Civ1_param]; %insert the names of the two input images
     194        %indicate the values of all the global attributes in the output data
     195        Data.Civ1_ImageA=ImageName_A;
     196        Data.Civ1_ImageB=ImageName_B;
     197        Data.Civ1_Time=((time(i2_civ1(ifile)+1,j2_civ1(j)+1)+time(i1_civ1(ifile)+1,j1_civ1(j)+1))/2);
     198        Data.Civ1_Dt=(time(i2_civ1(ifile)+1,j2_civ1(j)+1)-time(i1_civ1(ifile)+1,j1_civ1(j)+1));
    193199        for ilist=1:length(list_param)
    194             Civ1_param{ilist}=['Civ1_' list_param{ilist}];
    195             Data.(['Civ1_' list_param{ilist}])=Param.ActionInput.Civ1.(list_param{ilist});
     200            Data.(Civ1_param{4+ilist})=Param.ActionInput.Civ1.(list_param{ilist});
    196201        end
    197202        Data.ListGlobalAttribute=[Data.ListGlobalAttribute Civ1_param];
     
    391396        ibx2=ceil(par_civ2.CorrBoxSize(1)/2);
    392397        iby2=ceil(par_civ2.CorrBoxSize(2)/2);
    393         %     isx2=ibx2+4;% search ara +-4 pixels around the guess
    394         %     isy2=iby2+4;
    395398        par_civ2.SearchBoxSize(1)=2*ibx2+9;% search ara +-4 pixels around the guess
    396399        par_civ2.SearchBoxSize(2)=2*iby2+9;
    397         %par_civ2.SearchBoxSize(1)=2*isx2+1;
    398         %par_civ2.SearchBoxSize(2)=2*isy2+1;
    399400        par_civ2.SearchBoxShift=[Shiftx(nbval>=1)./nbval(nbval>=1) Shifty(nbval>=1)./nbval(nbval>=1)];
    400401        par_civ2.Grid=[GridX(nbval>=1)-par_civ2.SearchBoxShift(:,1)/2 GridY(nbval>=1)-par_civ2.SearchBoxShift(:,2)/2];% grid taken at the extrapolated origin of the displacement vectors
     
    409410
    410411        list_param=(fieldnames(Param.ActionInput.Civ2))';
    411         list_remove={'pxcmx','pxcmy','npx','npy','gridflag','maskflag','term_a','term_b','T0'};
    412         for ilist=1:length(list_remove)
    413             index=strcmp(list_remove{ilist},list_param);
    414             if ~isempty(find(index,1))
    415                 list_param(index)=[];
    416             end
    417         end
     412        Civ2_param=regexprep(list_param,'^.+','Civ2_$0');% insert 'Civ2_' before  each string in list_param
     413        Civ2_param=[{'Civ2_ImageA','Civ2_ImageB','Civ2_Time','Civ2_Dt'} Civ2_param]; %insert the names of the two input images
     414        %indicate the values of all the global attributes in the output data
     415        Data.Civ2_ImageA=ImageName_A;
     416        Data.Civ2_ImageB=ImageName_B;
     417        Data.Civ2_Time=1;
     418        Data.Civ2_Dt=1;
    418419        for ilist=1:length(list_param)
    419             Civ2_param{ilist}=['Civ2_' list_param{ilist}];
    420             eval(['Data.Civ2_' list_param{ilist} '=Param.ActionInput.Civ2.' list_param{ilist} ';'])
    421         end
    422         if isfield(Data,'Civ2_gridname') && strcmp(Data.Civ1_gridname(1:6),'noFile')
    423             Data.Civ1_gridname='';
    424         end
    425         if isfield(Data,'Civ2_maskname') && strcmp(Data.Civ1_maskname(1:6),'noFile')
    426             Data.Civ2_maskname='';
    427         end
    428         Data.ListGlobalAttribute=[Data.ListGlobalAttribute Civ2_param {'Civ2_Time','Civ2_Dt'}];
     420            Data.(Civ2_param{4+ilist})=Param.ActionInput.Civ2.(list_param{ilist});
     421        end
     422        Data.ListGlobalAttribute=[Data.ListGlobalAttribute Civ2_param];
     423       
    429424        nbvar=numel(Data.ListVarName);
    430425        Data.ListVarName=[Data.ListVarName {'Civ2_X','Civ2_Y','Civ2_U','Civ2_V','Civ2_F','Civ2_C'}];%  cell array containing the names of the fields to record
Note: See TracChangeset for help on using the changeset viewer.