Changeset 1032 for trunk/src/series


Ignore:
Timestamp:
Mar 22, 2018, 9:27:17 PM (7 years ago)
Author:
sommeria
Message:

reading LaVision? images improved

Location:
trunk/src/series
Files:
2 edited

Legend:

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

    r1027 r1032  
    107107
    108108    %% check the validity of  input file types
    109     ImageTypeOptions={'image','multimage','mmreader','video','cine_phantom'};%allowed input file types(images)
     109    ImageTypeOptions={'image','multimage','mmreader','video','cine_phantom','image_DaVis'};%allowed input file types(images)
    110110    FileInfo=get_file_info(FirstFileName);
    111111    FileType=FileInfo.FileType;
     
    348348            imwrite(C,newname,'BitDepth',16); % save the new image
    349349        else
     350            if ~isfield(FileInfo{1},'BitDepth')
     351                FileInfo{1}.BitDepth=16;
     352            end
    350353            if isequal(FileInfo{1}.BitDepth,16)
    351354                C=uint16(Acor);
     
    379382                end
    380383                filename=fullfile_uvmat(RootPath{1},SubDir{1},RootFile{1},FileExt{1},NomType{1},i1_series{1}(ifile),[],j1);
    381                 Aread=read_image(filename,FileType{1},MovieObject{1},i1_series{1}(ifile));
     384                Aread=read_image(filename,FileType{1},MovieObject{1},frame_index{1}(ifile));
    382385                if ndims(Aread)==3;%color images
    383386                    Aread=sum(double(Aread),3);% take the sum of color components
  • trunk/src/series/turb_stat.m

    r1031 r1032  
    180180    InputFields{1}=Param.InputFields;
    181181end
     182if isempty(InputFields{1}.FieldName)
     183    disp('ERROR: input fields U, V and posibly curl and div must be entered by get_field...')
     184    return
     185end
    182186
    183187nbfiles=0;
     
    187191DataOut.ListGlobalAttribute= {'Conventions'};
    188192DataOut.Conventions= 'uvmat';
    189 DataOut.ListVarName={'coord_y', 'coord_x' ,'UMean' , 'VMean','u2Mean','v2Mean','u2Mean_1','v2Mean_1','uvMean','Counter'};
     193DataOut.ListVarName={'coord_y', 'coord_x' ,'UMean' , 'VMean','u2Mean','v2Mean','u2Mean_1','v2Mean_1','uvMean','CurlMean','DivMean','Curl2Mean','Div2Mean','Counter'};
    190194DataOut.VarDimName={'coord_y','coord_x',{'coord_y','coord_x'},{'coord_y','coord_x'},{'coord_y','coord_x'},{'coord_y','coord_x'},{'coord_y','coord_x'},{'coord_y','coord_x'},...
    191     {'coord_y','coord_x'},{'coord_y','coord_x'}};
     195    {'coord_y','coord_x'},{'coord_y','coord_x'},{'coord_y','coord_x'},{'coord_y','coord_x'},{'coord_y','coord_x'},{'coord_y','coord_x'}};
    192196DataOut.UMean=0;
    193197DataOut.VMean=0;
     
    198202DataOut.uvMean=0;
    199203DataOut.Counter=0;
     204DataOut.CurlMean=0;
     205DataOut.DivMean=0;
     206DataOut.Curl2Mean=0;
     207DataOut.Div2Mean=0;
    200208U2Mean=0;
    201209V2Mean=0;
     
    215223
    216224    %%%%%%%%%%%% MAIN RUNNING OPERATIONS  %%%%%%%%%%%%
    217     if index==1 %first field
     225    if index==1 %initiate the output data structure in the first field
    218226       
    219227        DataOut.coord_y=Field.coord_y;
    220228        DataOut.coord_x=Field.coord_x;
    221         Uprev=Field.U;
     229        Uprev=Field.U;% store the current field for next iteration
    222230        Vprev=Field.V;
    223231        if isfield(Field,'FF')
    224         FFprev=Field.FF;
     232        FFprev=Field.FF;% possible flag for false data
    225233        else
    226             FFprev=true(size(Field.U));
     234            %FFprev=true(size(Field.U));
     235            FFprev=isnan(Field.U);
    227236        end
    228237    end
     
    242251    Vprev=Field.V;
    243252    FFprev=FF;
     253    if isfield(Field,'curl') && isfield(Field,'div')
     254        Field.curl(FF)=0;% set to 0 the nan values
     255        Field.div(FF)=0;
     256        DataOut.CurlMean=DataOut.CurlMean+Field.curl;
     257        DataOut.DivMean=DataOut.DivMean+Field.div;
     258        DataOut.Curl2Mean=DataOut.Curl2Mean+Field.curl.*Field.curl;
     259        DataOut.Div2Mean=DataOut.Div2Mean+Field.div.*Field.div;
     260    end
    244261end
    245262%%%%%%%%%%%%%%%% end loop on field indices %%%%%%%%%%%%%%%%
     
    258275DataOut.u2Mean_1=U2Mean_1-DataOut.UMean.*DataOut.UMean; % normalize the mean
    259276DataOut.v2Mean_1=V2Mean_1-DataOut.VMean.*DataOut.VMean; % normalize the mean
    260 
     277DataOut.CurlMean=DataOut.CurlMean./DataOut.Counter;
     278DataOut.DivMean=DataOut.DivMean./DataOut.Counter;
     279DataOut.Curl2Mean=DataOut.Curl2Mean./DataOut.Counter-DataOut.CurlMean.*DataOut.CurlMean;
     280DataOut.Div2Mean=DataOut.Div2Mean./DataOut.Counter-DataOut.DivMean.*DataOut.DivMean;
    261281
    262282%% calculate the profiles
Note: See TracChangeset for help on using the changeset viewer.