Changeset 993 for trunk/src/series


Ignore:
Timestamp:
Feb 6, 2017, 11:29:01 AM (8 years ago)
Author:
sommeria
Message:

various updates

Location:
trunk/src/series
Files:
3 edited

Legend:

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

    r990 r993  
    358358        end
    359359    end
    360     %remove wrong vector
    361     temp=find(Data{1}.FF==0);
    362     X1=Data{1}.X(temp);
    363     Y1=Data{1}.Y(temp);
    364     U1=Data{1}.U(temp);
    365     V1=Data{1}.V(temp);
    366    
     360    %remove wrong vector 
     361    if isfield(Data{1},'FF')
     362        temp=find(Data{1}.FF==0);
     363        X1=Data{1}.X(temp);
     364        Y1=Data{1}.Y(temp);
     365        U1=Data{1}.U(temp);
     366        V1=Data{1}.V(temp);
     367    else
     368        X1=Data{1}.X;
     369        Y1=Data{1}.Y;
     370        U1=Data{1}.U;
     371        V1=Data{1}.V;
     372    end
    367373    Ua=griddata(X1,Y1,U1,Xa,Ya);
    368374    Va=griddata(X1,Y1,V1,Xa,Ya);
    369    
    370     [Ua,Va,Xa,Ya]=Ud2U(XmlData{1}.GeometryCalib,Xa,Ya,Ua,Va); % convert Xd data to X
     375    [Ua,Va,Xa,Ya]=Ud2U(XmlData{1}.GeometryCalib,Xa,Ya,Ua,Va); % convert Xd data to X
    371376    [A]=get_coeff(XmlData{1}.GeometryCalib,Xa,Ya,XI,YI,ZI); %get coef A~
    372377   
    373     %remove wrong vector
    374     temp=find(Data{2}.FF==0);
    375     X2=Data{2}.X(temp);
    376     Y2=Data{2}.Y(temp);
    377     U2=Data{2}.U(temp);
    378     V2=Data{2}.V(temp);
     378    %remove wrong vector 
     379    if isfield(Data{1},'FF')
     380        temp=find(Data{2}.FF==0);
     381        X2=Data{2}.X(temp);
     382        Y2=Data{2}.Y(temp);
     383        U2=Data{2}.U(temp);
     384        V2=Data{2}.V(temp);
     385    else
     386        X2=Data{2}.X;
     387        Y2=Data{2}.Y;
     388        U2=Data{2}.U;
     389        V2=Data{2}.V;
     390    end
    379391    Ub=griddata(X2,Y2,U2,Xb,Yb);
    380392    Vb=griddata(X2,Y2,V2,Xb,Yb);
    381 
    382     [Ub,Vb,Xb,Yb]=Ud2U(XmlData{2}.GeometryCalib,Xb,Yb,Ub,Vb); % convert Xd data to X
     393    [Ub,Vb,Xb,Yb]=Ud2U(XmlData{2}.GeometryCalib,Xb,Yb,Ub,Vb); % convert Xd data to X
     394   
    383395    [B]=get_coeff(XmlData{2}.GeometryCalib,Xb,Yb,XI,YI,ZI); %get coef B~
    384    
     396    
    385397   
    386398    % System to solve
  • trunk/src/series/civ_series.m

    r981 r993  
    6060    Data.AllowInputSort='off';% allow alphabetic sorting of the list of input file SubDir (options 'off'/'on', 'off' by default)
    6161    Data.WholeIndexRange='off';% prescribes the file index ranges from min to max (options 'off'/'on', 'off' by default)
    62     if isfield(Data,'ActionInput') && isfield(Data.ActionInput,'PairIndices')&& strcmp(Data.ActionInput.PairIndices.ListPairMode,'pair j1-j2')
    63         Data.Desable_j_index='on';% hide the j index in series (set by the pair choice in civ_input)
    64     end
     62    %     if isfield(Data,'ActionInput') && isfield(Data.ActionInput,'PairIndices')&& strcmp(Data.ActionInput.PairIndices.ListPairMode,'pair j1-j2')
     63    %         Data.Desable_j_index='on';% hide the j index in series (set by the pair choice in civ_input)
     64    %     end
    6565    Data.NbSlice='off'; %nbre of slices ('off' by default)
    6666    Data.VelType='off';% menu for selecting the velocity type (options 'off'/'one'/'two',  'off' by default)
     
    7373    Data.OutputFileMode='NbInput_i';% one output file expected per value of i index (used for waitbar)
    7474    Data.CheckOverwriteVisible='on'; % manage the overwrite of existing files (default=1)
     75    if isequal(Data.ActionInput.PairIndices.ListPairMode,'pair j1-j2')
     76        if isfield(Data.ActionInput.PairIndices,'ListPairCiv2')
     77            str_civ=Data.ActionInput.PairIndices.ListPairCiv2;
     78        else
     79            str_civ=Data.ActionInput.PairIndices.ListPairCiv1;
     80        end
     81        r=regexp(str_civ,'^j= (?<num1>[a-z])-(?<num2>[a-z])','names');
     82        if isempty(r)
     83            r=regexp(str_civ,'^j= (?<num1>[A-Z])-(?<num2>[A-Z])','names');
     84            if isempty(r)
     85                r=regexp(str_civ,'^j= (?<num1>\d+)-(?<num2>\d+)','names');
     86            end
     87        end
     88        if ~isempty(r)
     89            Data.j_index_1=stra2num(r.num1);
     90            Data.j_index_2=stra2num(r.num2);
     91        end
     92    end
    7593    return
    7694end
     
    200218        end
    201219        if isempty(i1_series_Civ1)||(~isempty(PairCiv2) && isempty(i1_series_Civ2))
    202             disp_uvmat('ERROR','no image pair fo civ in the input file index range',checkrun)
     220            disp_uvmat('ERROR','no image pair for civ in the input file index range',checkrun)
    203221            return
    204222        end
     
    208226    try
    209227        if Param.ActionInput.CheckCiv1% Civ1 is performed
     228            first_ima=1;
    210229            ImageName_A=fullfile_uvmat(RootPath_A,SubDir_A,RootFile_A,FileExt_A,NomType_A,i1_series_Civ1(1),[],j1_series_Civ1(1));
    211             if ~exist(ImageName_A,'file')
     230            if checkrun
     231                if ~exist(ImageName_A,'file')
    212232                disp_uvmat('ERROR',['first input image ' ImageName_A ' does not exist'],checkrun)
    213233                return
     234                end
     235            else
     236%                 for ifile=1:numel(i1_series_Civ1)
     237%                     if
    214238            end
    215239            [FileInfo_A,VideoObject_A]=get_file_info(ImageName_A);
     
    412436                if ~isempty(ME.message)
    413437                    disp_uvmat('ERROR', ['error reading input image: ' ME.message],checkrun)
    414                     return
     438                    continue
    415439                end
    416440            end
     
    11551179[npy,npx]=size(result_conv);
    11561180result_conv(result_conv<1)=1; %set to 1 correlation values smaller than 1  (=0 by discretisation, to avoid divergence in the log)
    1157 %the following 8 lines are copyright (c) 1998, Uri Shavit, Roi Gurka, Alex Liberzon, Technion ï¿œ Israel Institute of Technology
     1181%the following 8 lines are copyright (c) 1998, Uri Shavit, Roi Gurka, Alex Liberzon, Technion ??? Israel Institute of Technology
    11581182%http://urapiv.wordpress.com
    11591183peaky = y;
     
    11921216        for j=-1:1
    11931217            %following 15 lines based on
    1194             %H. Nobach ï¿œ M. Honkanen (2005)
     1218            %H. Nobach ??? M. Honkanen (2005)
    11951219            %Two-dimensional Gaussian regression for sub-pixel displacement
    11961220            %estimation in particle image velocimetry or particle position
    11971221            %estimation in particle tracking velocimetry
    1198             %Experiments in Fluids (2005) 38: 511ï¿œ515
     1222            %Experiments in Fluids (2005) 38: 511???515
    11991223            c10(j+2,i+2)=i*log(result_conv(y+j, x+i));
    12001224            c01(j+2,i+2)=j*log(result_conv(y+j, x+i));
  • trunk/src/series/extract_multitif_parallel.m

    r991 r993  
    9595        return
    9696    end
    97     xmlinput=uigetfile_uvmat('pick xml file for timing',fileparts(fileparts(FirstFileName)),'.xml');
    98     [tild,ParamOut.ActionInput.XmlFile]=fileparts(xmlinput);
    99     ParamOut.ActionInput.XmlFile
    100    
     97    ParamOut.ActionInput.XmlFile=uigetfile_uvmat('pick xml file for timing',fileparts(fileparts(FirstFileName)),'.xml'); 
    10198    return
    10299end
     
    140137
    141138%% Timing
    142 XmlInputFile=fullfile(Param.InputTable{1,1},[Param.ActionInput.XmlFile '.xml'])
    143 XmlInput=imadoc2struct(XmlInputFile,'Camera');
    144 
    145 %% create the xml file of PCO camera
     139XmlInputFile=Param.ActionInput.XmlFile;
     140[XmlInput,errormsg]=imadoc2struct(XmlInputFile,'Camera');
     141if ~isempty(errormsg)
     142    disp(['bad xml input file: ' errormsg])
     143    return
     144end
     145ImagesPerLevel=size(XmlInput.Time,2)-1;%100;%use the xmlinformation to get the nbre of j indices
     146
     147%% create the xml file of PCO camera if it does not exist
     148Newxml=fullfile(Param.InputTable{1,1},[Param.InputTable{1,2} '.xml']);
     149if ~exist(Newxml,'file')
    146150XmlInput.Camera.CameraName='PCO';
    147 t=struct2xml(XmlInput.Camera);
     151XmlInput=rmfield(XmlInput,'Time');
     152XmlInput=rmfield(XmlInput,'TimeUnit');
     153t=struct2xml(XmlInput);
    148154t=set(t,1,'name','ImaDoc');
    149 save(t,fullfile(Param.InputTable{1,1},[Param.InputTable{1,2} '.xml']))
     155save(t,Newxml);
     156end
    150157
    151158%% Main loop
    152159
    153 ImagesPerLevel=size(XmlInput.Time,2)-1;%100;
     160
    154161% count=0;
    155162%count=316;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%CORRECTION EXP08: 4684 images -> start at 316 start 67->_11_1
    156163%count=1934%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%CORRECTION EXP07: 3066 images
    157164%% loop on the files
    158 %for ifile=1:numel(ListFile)
    159 %     update_waitbar(WaitbarHandle,ifile/numel(ListFile))
    160 %     if ~isempty(RUNHandle)&& ~strcmp(get(RUNHandle,'BusyAction'),'queue')
    161 %         disp('program stopped by user')
    162 %         break
    163 %     end
    164 %    ImageName=fullfile(DirImages,ListFile{ifile});
    165 %   NbFrames=numel(imfinfo(ImageName));
    166 % loop on the frames within the tiff file
     165% include the first tiff file with no index in the first iteration
    167166if Param.IndexRange.first_i==1% first slice of processing
    168167    firstindex=0;
    169168   count=0;
    170 %     count=3;
    171169else
    172170    firstindex=Param.IndexRange.first_i;
     
    174172    NbFrames=numel(imfinfo(ImageName));
    175173   count=Param.IndexRange.first_i*NbFrames;
    176  %   count=Param.IndexRange.first_i*NbFrames+3;
    177174end
    178175for ifile=firstindex:Param.IndexRange.last_i
    179176    if firstindex==0 && ifile==0% first slice of processing
    180             ImageName=fullfile(Param.InputTable{1,1},Param.InputTable{1,2},'im.tif')
     177        ImageName=fullfile(Param.InputTable{1,1},Param.InputTable{1,2},'im.tif')
    181178    else
    182179        ImageName=fullfile(Param.InputTable{1,1},Param.InputTable{1,2},['im@' num2str(ifile,'%04d') '.tif'])
     
    202199    end
    203200end
    204     %end
    205 
    206 % for ifile=1:numel(ListFile)
    207 %     update_waitbar(WaitbarHandle,ifile/numel(ListFile))
    208 %     if ~isempty(RUNHandle)&& ~strcmp(get(RUNHandle,'BusyAction'),'queue')
    209 %         disp('program stopped by user')
    210 %         break
    211 %     end
    212 %     ImageName=fullfile(DirImages,ListFile{ifile});
    213 %     NbFrames=numel(imfinfo(ImageName));
    214 %     % loop on the frames within the tiff file
    215 %     for iframe=1:NbFrames     
    216 %         A=imread(ImageName,iframe);
    217 %
    218 %         if isequal(ImagesPerLevel,1)% mode series
    219 %             i_index=count+1;
    220 %             OutputFile=fullfile(OutputDir,['img_' num2str(count+1) '.png']);
    221 %         else % indices i and j
    222 %             i_index=fix(count/ImagesPerLevel)+1;
    223 %             j_index=mod(count,ImagesPerLevel)+1;
    224 %             OutputFile=fullfile(OutputDir,['img_' num2str(i_index) '_' num2str(j_index) '.png']);
    225 %         end
    226 %         imwrite(A,OutputFile,'BitDepth',16)
    227 %         count=count+1;
    228 %     end
    229 % end
    230 
    231 %% create the xml file of PCO camera
    232 % XmlInput.Camera.CameraName='PCO';
    233 % t=struct2xml(XmlInput.Camera);
    234 % t=set(t,1,'name','ImaDoc');
    235 % save(t,fullfile(Param.InputTable{1,1},'PCO.xml'))
    236 
    237 %% remove initial files if transfer OK
    238 %     if i_index== (size(XmlInput.Time,1)-1)
    239 %
    240 %         [SUCCESS,MESSAGE]=rmdir(DirImages,'s')
    241 %       
    242 %     end
     201
     202
     203
Note: See TracChangeset for help on using the changeset viewer.