Changeset 1129 for trunk


Ignore:
Timestamp:
Mar 1, 2024, 8:09:20 PM (10 months ago)
Author:
sommeria
Message:

LIF calibration update and extrct_multitif

Location:
trunk/src
Files:
1 added
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/phys_ima.m

    r1112 r1129  
    1111% XmlData: cell array of structures defining the calibration parameters for each image
    1212% ZIndex: index of the reference plane used to define the phys position in 3D
    13 
    14 function [A_out,Rangx,Rangy]=phys_ima(A,XmlData,ZIndex)
     13% resolution_factor: factor to control the number of pixels of the new image, default value =1 : same nbre of pixels as the original
     14function [A_out,Rangx,Rangy]=phys_ima(A,XmlData,ZIndex,resolution_factor)
    1515xcorner=[];
    1616ycorner=[];
     
    2121if isstruct(XmlData)
    2222    XmlData={XmlData};
     23end
     24if ~exist('resolution_factor','var')
     25resolution_factor=1;
    2326end
    2427
     
    5053test_multi=(max(npx)~=min(npx)) || (max(npy)~=min(npy)); %different image lengths
    5154
    52 npX=1+round((Rangx(2)-Rangx(1))/max(dx));% nbre of pixels in the new image (use the largest resolution max(dx) in the set of images)
    53 npY=1+round((Rangy(1)-Rangy(2))/max(dy));
     55npX=1+round(resolution_factor*(Rangx(2)-Rangx(1))/max(dx));% nbre of pixels in the new image (use the largest resolution max(dx) in the set of images)
     56npY=1+round(resolution_factor*(Rangy(1)-Rangy(2))/max(dy));
    5457
    5558x=linspace(Rangx(1),Rangx(2),npX);
  • trunk/src/series/aver_stat.m

    r1127 r1129  
    298298        for iview=1:NbView
    299299            % reading input file(s)
     300            filecell{iview,index}
    300301            [Data{iview},tild,errormsg] = read_field(filecell{iview,index},FileType{iview},InputFields{iview},frame_index{iview}(index));
    301302            if ~isempty(errormsg)
     
    469470   
    470471    %% writing the result file
    471     OutputFile=fullfile_uvmat(OutputPath,OutputDir,RootFile{1},FileExtOut,NomTypeOut,first_i,last_i,first_j_out,last_j_out);
     472    RootPathOut=fullfile(Param.OutputPath,Param.Experiment,Param.Device);
     473    OutputDir=[Param.OutputSubDir Param.OutputDirExt];
     474    OutputFile=fullfile_uvmat(RootPathOut,OutputDir,RootFile{1},FileExtOut,NomTypeOut,first_i,last_i,first_j_out,last_j_out);
    472475    if strcmp(FileExtOut,'.png') %case of images
    473476        if isequal(FileInfo{1}.BitDepth,16)||(numel(FileInfo)==2 &&isequal(FileInfo{2}.BitDepth,16))
  • trunk/src/series/extract_multitif.m

    r1127 r1129  
    11%'extract_multitif': read image series from PCO cameras (tiff image series) and write .png images
    2 %------------------------------------------------------------------------
    3    
     2% use a single geometric calibration, with information on the slice positions in case of 3D scanning
     3%------------------------------------------------------
     4% the output file indexing is based on the xml file requested by the
     5% function when it is selected (or possibly inserted in this function in the section TEST)
     6%  This xml file must contain the following information:
     7%   NbDti: the number of 'bursts' -1
     8%   NbDtj: number of frames in each burst-1, or number of repetition of a burst sequence defined by Dtj
     9%   NbDtk: number of repetitions of a slice scanning process -1 (ignored by default)
     10% Therefore the total number of frames is  (NbDti+1)*(NbDtj+1)*(NbDtk+1)
     11% The frame series is stored in a single folder with two indices i:(NbDti+1)*(NbDtk+1)
     12%
     13% To run the function in the cluster in parallel for each multitif file, indicate nb-slice_i equal to the
     14% number input multitif files
     15
     16
    417% function ParamOut=extract_multitif(Param)
    518%
  • trunk/src/series/stereo_input.m

    r1127 r1129  
    243243%show the reference image edit box if relevant (not needed for movies or in the absence of time information
    244244if numel(time)>=2 % if there are at least two time values to define dt
    245     if size(time,1)<MaxIndex_i;
     245    if size(time,1)<MaxIndex_i
    246246        msgbox_uvmat('WARNING','maximum i index restricted by the timing of the xml file');
    247247    elseif size(time,2)<MaxIndex_j
     
    29742974
    29752975% Hint: get(hObject,'Value') returns toggle state of CheckLSM
     2976
     2977
     2978
     2979function num_resolution_Callback(hObject, eventdata, handles)
     2980% hObject    handle to num_resolution (see GCBO)
     2981% eventdata  reserved - to be defined in a future version of MATLAB
     2982% handles    structure with handles and user data (see GUIDATA)
     2983
     2984% Hints: get(hObject,'String') returns contents of num_resolution as text
     2985%        str2double(get(hObject,'String')) returns contents of num_resolution as a double
     2986
     2987
     2988% --- Executes during object creation, after setting all properties.
     2989function num_resolution_CreateFcn(hObject, eventdata, handles)
     2990% hObject    handle to num_resolution (see GCBO)
     2991% eventdata  reserved - to be defined in a future version of MATLAB
     2992% handles    empty - handles not created until after all CreateFcns called
     2993
     2994% Hint: edit controls usually have a white background on Windows.
     2995%       See ISPC and COMPUTER.
     2996if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
     2997    set(hObject,'BackgroundColor','white');
     2998end
  • trunk/src/series/turb_stat.m

    r1127 r1129  
    1 %'aver_stat': calculate Reynolds steress components over time series
     1%'aver_stat': calculate Reynolds stress components over time series
    22%------------------------------------------------------------------------
    33% function ParamOut=turb_stat(Param)
     
    8989RUNHandle=findobj(hseries,'Tag','RUN');%handle of RUN button in GUI series
    9090WaitbarHandle=findobj(hseries,'Tag','Waitbar');%handle of waitbar in GUI series
    91 
    92 %% define the directory for result file (with path=RootPath{1})
    93 OutputDir=[Param.OutputSubDir Param.OutputDirExt];
    9491   
    9592%% root input file(s) name, type and index series
     
    201198Counter_1=0;
    202199
     200if Param.IndexRange.NbSlice==1
     201    interval=Param.IndexRange.incr_i% statistics is done taking into account the input index increment
     202else
     203    interval=Param.IndexRange.NbSlice;% statistics is done slice by slice without taking into account the input index increment
     204end
     205
    203206%%%%%%%%%%%%%%%% loop on field indices %%%%%%%%%%%%%%%%
    204 % for i_slice=1:Param.IndexRange.NbSlice
    205 %     i_slice
     207for i_slice=1:Param.IndexRange.NbSlice
     208    i_slice
    206209    ind_first=Param.IndexRange.first_i;
    207     for index_i=ind_first:Param.IndexRange.NbSlice:Param.IndexRange.last_i
     210    for index_i=ind_first:interval:Param.IndexRange.last_i
    208211        if ~isempty(RUNHandle)&& ~strcmp(get(RUNHandle,'BusyAction'),'queue')
    209212            disp('program stopped by user')
     
    211214        end
    212215        for index_j=first_j:last_j
    213             InputFile=fullfile_uvmat(RootPath{1},SubDir{1},RootFile{1},FileExt{1},NomType{1},index_i,index_i,index_j,index_j);
    214             [Field,tild,errormsg] = read_field(InputFile,FileType{iview},InputFields{iview});
    215            
    216             %[Field,tild,errormsg] = read_field(filecell{1,index},FileType{iview},InputFields{iview},frame_index{iview}(index));
     216            InputFile=fullfile_uvmat(RootPath{1},SubDir{1},RootFile{1},FileExt{1},NomType{1},index_i,index_i,index_j,index_j)
     217            [Field,tild,errormsg] = read_field(InputFile,FileType{iview},InputFields{iview});       
    217218           
    218219            %%%%%%%%%%%% MAIN RUNNING OPERATIONS  %%%%%%%%%%%%
     
    289290   
    290291    %% writing the result file as netcdf file
    291     OutputFile=fullfile_uvmat(RootPath{1},OutputDir,RootFile{1},FileExtOut,NomTypeOut,ind_first,ind_first,first_j,last_j);
     292    RootPathOut=fullfile(Param.OutputPath,Param.Experiment,Param.Device);
     293    OutputDir=[Param.OutputSubDir Param.OutputDirExt];
     294    OutputFile=fullfile_uvmat(RootPathOut,OutputDir,RootFile{1},FileExtOut,NomTypeOut,ind_first,ind_first,first_j,last_j);
    292295    %case of netcdf input file , determine global attributes
    293296    errormsg=struct2nc(OutputFile,DataOut); %save result file
     
    296299    else
    297300        disp(['error in writting result file: ' errormsg])
    298     end
    299    
    300 % end
     301    end   
     302end
     303
    301304%% open the result file with uvmat (in RUN mode)
    302305if checkrun && isequal(Param.IndexRange.NbSlice,1)
  • trunk/src/uvmat.m

    r1127 r1129  
    16571657
    16581658%% rescale the image
    1659 [nby,nbx]=size(UvData.Field.A);
    1660 x=linspace(UvData.Field.Coord_x(1),UvData.Field.Coord_x(2),nbx)-nbx/2;
    1661 y=linspace(UvData.Field.Coord_y(1),UvData.Field.Coord_y(2),nby)-nby/2;
    1662 [X,Y]=meshgrid(x,y);
     1659% [nby,nbx]=size(UvData.Field.A);
     1660% x=linspace(UvData.Field.Coord_x(1),UvData.Field.Coord_x(2),nbx)-nbx/2;
     1661% y=linspace(UvData.Field.Coord_y(1),UvData.Field.Coord_y(2),nby)-nby/2;
     1662% [X,Y]=meshgrid(x,y);
    16631663%coeff_quad=0.15*4/(nbx*nbx);% image luminosity reduced by 10% at the edge
    16641664%UvData.Field.A=double(UvData.Field.A).*(1+coeff_quad*(X.*X+Y.*Y));
     
    16861686    ylabel('radius from light source')
    16871687    title('ref line in polar coordinates')
    1688     azimuth_ima=linspace(DataPol.Coord_y(1),DataPol.Coord_y(2),size(DataPol.A,1))-360;%array of angular indices on the transformed image
    1689     dist_source = interp1(theta_ref,r_ref,azimuth_ima);% get the polar position of the reference line
    1690     dist_source_pixel=round(size(DataPol.A,2)*(dist_source-DataPol.Coord_x(1))/(DataPol.Coord_x(2)-DataPol.Coord_x(1)));
     1688    %azimuth_ima=linspace(DataPol.Coord_y(1),DataPol.Coord_y(2),size(DataPol.A,1));%array of angular indices on the transformed image
     1689   % dist_source = interp1(theta_ref,r_ref,azimuth_ima);% get the polar position of the reference line
     1690    dist_source = interp1(theta_ref,r_ref,DataPol.theta);% get the polar position of the reference line
     1691    dist_source_pixel=floor(size(DataPol.A,2)*(dist_source-DataPol.radius(1))/(DataPol.radius(end)-DataPol.radius(1)))+1;
    16911692    line_nan= isnan(dist_source);
    16921693    dist_source_pixel(line_nan)=1;
     
    17101711%% get the image A*r
    17111712[npy,npx]=size(Anorm);
    1712 AX=DataPol.Coord_x;
    1713 AY=DataPol.Coord_y;
    1714 dX=(AX(2)-AX(1))/(npx-1);
    1715 dY=(AY(1)-AY(2))/(npy-1);%mesh of new pixels
    1716 [R,Theta]=meshgrid(linspace(AX(1),AX(2),npx),linspace(AY(1),AY(2),npy));
     1713AX=DataPol.radius;
     1714AY=DataPol.theta;
     1715% dX=(AX(2)-AX(1))/(npx-1);
     1716% dY=(AY(1)-AY(2))/(npy-1);%mesh of new pixels
     1717[R,Theta]=meshgrid(linspace(AX(1),AX(end),npx),linspace(AY(1),AY(end),npy));%matrix of radius and angles with the same size as DataPol
    17171718A=R.*Anorm;
    17181719A=(A<=0).*ones(npy,npx)+(A>0).*A; %replaces zeros by ones
     
    17341735gamma_coeff=NaN(1,npy);
    17351736fitlength=NaN(1,npy);
     1737%[ThetaMask,RMask] = cart2pol(MaskData.Coord(:,1)-x0,MaskData.Coord(:,2)-y0);
     1738%ThetaMask=ThetaMask*180/pi
    17361739for iY=1:npy% loop on the y index of the image in polar coordinate
    17371740    ALine=A(iY,:);%profile of image luminosity log (vs radial index)
     
    17521755    p = polyfit(RLine,ALine,1);
    17531756    gamma_coeff(iY)=-p(1);
    1754     fitlength(iY)=numel(find(check_good));
    1755 end
     1757   fitlength(iY)=numel(find(check_good));
     1758end
     1759
     1760%% plot the decay coef versus theta
     1761figure(13)
     1762plot(Theta(:,1),100*gamma_coeff)
     1763xlabel('angle(degree)')
     1764ylabel('decay coeff(m-1)')
     1765
    17561766
    17571767%% show and store the rescaled image
     
    17601770view_field(DataPol);
    17611771imwrite(DataPol.A,NewImageName,'BitDepth',16)
    1762 figure(13)
    1763 plot(Theta(:,1),100*gamma_coeff)
    1764 xlabel('angle(degree)')
    1765 ylabel('decay coeff(m-1)')
     1772
    17661773
    17671774%% keep the average of gamma_coeff
Note: See TracChangeset for help on using the changeset viewer.