Changeset 1032 for trunk


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

reading LaVision? images improved

Location:
trunk/src
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/get_file_info.m

    r1027 r1032  
    6565             FileInfo.Height=size(Image,2);
    6666             FileInfo.Width=size(Image,1);
     67             FileInfo.TimeName='timestamp';
     68             DateString=Input.Attributes{60}.Value
     69             TimeString=Input.Attributes{59}.Value
    6770        catch ME
    68             msgbox_uvmat('ERROR',ME.message)
     71            msgbox_uvmat('ERROR',[ME.message;'reading image from DaVis is possible only with Matlab version 2013 or earlier'])
    6972            return
    7073        end
     
    8386        FileInfo.Width=BitmapInfoHeader.biWidth;
    8487         FileInfo.BitDepth=BitmapInfoHeader.biBitCount;
     88         FileInfo.TimeName='video';
    8589    otherwise
    8690        if ~isempty(FileExt)% exclude empty extension
     
    149153                            FileInfo.BitDepth=FileInfo.BitsPerPixel/3;
    150154                            FileInfo.ColorType='truecolor';
     155                            FileInfo.TimeName='video';
    151156                            FileInfo.FileName=fileinput;
    152157                            nbfield=numel(fieldnames(FileInfo));
    153                             FileInfo=orderfields(FileInfo,[nbfield nbfield-3 nbfield-1 nbfield-2 (1:nbfield-4)]); %reorder the fields of fileInfo for clarity
     158                            FileInfo=orderfields(FileInfo,[nbfield nbfield-4 nbfield-3 nbfield-1 nbfield-2 (1:nbfield-5)]); %reorder the fields of fileInfo for clarity
    154159                            if ~isfield(FileInfo,'NumberOfFrames')
    155160                                FileInfo.NumberOfFrames=floor(FileInfo.Duration*FileInfo.FrameRate);
  • trunk/src/read_field.m

    r1027 r1032  
    273273        Input=readimx(FileName);
    274274        A=Input.Frames{num}.Components{1}.Planes{1}';
     275        %timestamps=double(Input.Attributes{1}.Value(2))/1000000;
     276        timestamps=str2num(Input.Frames{1}.Attributes{12}.Value(1:end-3))/1000000;
    275277    case 'cine_phantom'
    276278        [A,FileInfo] = read_cine_phantom(FileName,num );
     
    281283%% case of image
    282284if ~isempty(A)
    283     if strcmp(FileType,'rdvision')
     285    if strcmp(FileType,'rdvision')||strcmp(FileType,'image_DaVis')
    284286        Field.Time=timestamps;
    285287    end
  • trunk/src/read_rdvision.m

    r1027 r1032  
    6767    FileInfo.FrameRate=str2double(s.sequenceSettings.framepersecond);
    6868    FileInfo.ColorType='grayscale';
     69    FileInfo.TimeName='timestamp';
    6970else
    7071    FileInfo.FileType='';
  • 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
  • trunk/src/uvmat.m

    r1031 r1032  
    20622062        XmlData.Time=[0;ones(size(i1_series,3)-1,1)]*(0:1/FileInfo.FrameRate:(FileInfo.NumberOfFrames)/FileInfo.FrameRate);
    20632063    end
    2064     if strcmp(FileInfo.FileType,'rdvision')
    2065         TimeName='timestamp';
    2066     else
    2067     TimeName='video';
    2068     end
     2064%     if strcmp(FileInfo.FileType,'rdvision')
     2065%         TimeName='timestamp';
     2066%     else
     2067%     TimeName='video';
     2068%     end
     2069end
     2070if isfield(FileInfo,'TimeName')
     2071    TimeName=FileInfo.TimeName;
    20692072end
    20702073if isfield(FileInfo,'ColorType')
     
    33413344            frame_index=num_j1;% frame index from a set of indexed movies
    33423345        end
     3346        if isempty(frame_index)
     3347            frame_index=1;
     3348        end
    33433349    case 'multimage'
    33443350        FieldName='image';
     
    33693375        end
    33703376    case {'image','image_DaVis'}
    3371         FieldName='image';     
     3377        FieldName='image'; 
     3378        frame_index=num_j1;%frame index for image pairs
    33723379end
    33733380if isstruct (ParamIn)
Note: See TracChangeset for help on using the changeset viewer.