Changeset 89 for trunk/src/series


Ignore:
Timestamp:
May 20, 2010, 1:48:25 AM (15 years ago)
Author:
sommeria
Message:

many bug corrections and cleaning. Activation of the BW option in uvmat. Improvement of the interaction of get_field with uvmat.

Location:
trunk/src/series
Files:
2 edited

Legend:

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

    r78 r89  
    1 function GUI_input=merge_proj(num_i1,num_i2,num_j1,num_j2,Series);
     1function GUI_input=merge_proj(num_i1,num_i2,num_j1,num_j2,Series)
    22
    33%requests for the visibility of input windows in the GUI series  (activated directly by the selection in the menu ACTION)
     
    6565    if ~isequal(hhh,'')&& mmreader.isPlatformSupported()
    6666        if isequal(lower(FileExt{iview}),'.avi')
    67             MovieObject{iview}=mmreader(fullfile(RootPath{iview},[RootFile{iview} FileExt{iview}]));
     67            MovieObject{iview}=mmreader(fullfile(Series.RootPath{iview},[Series.RootFile{iview} Series.FileExt{iview}]));
    6868            test_movie(iview)=1;
    6969        end
     
    117117%check coincidence in time
    118118multitime=0;
    119 if length(timecell)==0
     119if isempty(timecell)
    120120    time=[];
    121121elseif length(timecell)==1
     
    160160if isequal(FieldName,'get_field...')
    161161    hget_field=findobj(allchild(0),'Name','get_field');%find the get_field... GUI
    162    % hhget_field=guidata(hget_field);%handles of GUI elements in get_field
    163162    SubField=get_field('read_get_field',hObject,eventdata,hget_field); %read the names of the variables to plot in the get_field GUI
    164 %     if isequal(get(hhget_field.menu_coord,'Visible'),'on')
    165 %         list_transform=get(hhget_field.menu_coord,'String');
    166 %         val_list=get(hhget_field.menu_coord,'Value');
    167 %         transform=list_transform{val_list};
    168 %     end
    169163end
    170164%detect whether all the files are 'images' or 'netcdf'
     
    176170for iview=1:nbview
    177171     ext=FileExt{iview};
    178      form=imformats(ext([2:end]));
     172     form=imformats(ext(2:end));
    179173     if isequal(lower(ext),'.vol')
    180174         testvol=testvol+1;
     
    286280                Field{iview}=transform_fct(Field{iview},XmlData{iview});%transform to phys if requested
    287281            end
     282            min(Field{iview}.X)
    288283            if testcivx
    289284                    Field{iview}=calc_field(FieldName,Field{iview});
    290285            end
     286            min(Field{iview}.X)
    291287
    292288            %projection on object (gridded plane)
     
    386382        error=1;
    387383    end
    388 %      if ~isequal(MergeData.VarDimIndex,Data{iview}.VarDimIndex)
    389 %         error=1;
    390 %      end
    391384end
    392385if error
     
    394387    return
    395388end
     389
     390%group the variables (fields of 'FieldData') in cells of variables with the same dimensions
     391[CellVarIndex,NbDim,VarTypeCell]=find_field_indices(Data{1});
     392%LOOP ON GROUPS OF VARIABLES SHARING THE SAME DIMENSIONS
     393% CellVarIndex=cells of variable index arrays
     394ivar_new=0; % index of the current variable in the projected field
     395icoord=0;
     396for icell=1:length(CellVarIndex)
     397    if NbDim(icell)==1
     398        continue
     399    end
     400    VarIndex=CellVarIndex{icell};%  indices of the selected variables in the list FieldData.ListVarName
     401    VarType=VarTypeCell{icell};
     402    ivar_X=VarType.coord_x;
     403    ivar_Y=VarType.coord_y;
     404    ivar_FF=VarType.errorflag;
     405    if isempty(ivar_X)
     406        test_grid=1;%test for input data on regular grid (e.g. image)coordinates
     407    else
     408        if length(ivar_Y)~=1
     409                msgbox_uvmat('ERROR','y coordinate missing in proj_field.m')
     410                return
     411        end
     412        test_grid=0;
     413    end
     414%    DimIndices=Data{1}.VarDimIndex{VarIndex(1)};%indices of the dimensions of the first variable (common to all variables in the cell)
     415    %case of input fields with unstructured coordinates
     416    if ~test_grid
     417        for ivar=VarIndex
     418            VarName=MergeData.ListVarName{ivar};
     419            for iview=1:nbview
     420                eval(['MergeData.' VarName '=[MergeData.' VarName '; Data{iview}.' VarName '];'])
     421            end
     422        end
     423    %case of fields defined on a structured  grid
     424    else 
     425%        DimValue=MergeData.DimValue(DimIndices);%set of dimension values
     426        testFF=0;
     427        for iview=2:nbview
     428%             if ~isequal(DimValue,Data{iview}.DimValue(DimIndices))
     429%                 MergeData.Txt='ERROR: attempt at merging structured fields with different sizes';
     430%                 return
     431%             end
     432            for ivar=VarIndex
     433                VarName=MergeData.ListVarName{ivar};
     434                if isfield(MergeData,'VarAttribute')
     435                    if length(MergeData.VarAttribute)>=ivar && isfield(MergeData.VarAttribute{ivar},'Role') && isequal(MergeData.VarAttribute{ivar}.Role,'errorflag')
     436                        testFF=1;
     437                    end
     438                end
     439                eval(['MergeData.' VarName '=MergeData.' VarName '+ Data{iview}.' VarName ';'])
     440            end
     441        end
     442        if testFF
     443            nbaver=nbview-MergeData.FF;
     444            indgood=find(nbaver>0);
     445            for ivar=VarIndex
     446                VarName=MergeData.ListVarName{ivar};
     447                eval(['MergeData.' VarName '(indgood)=double(MergeData.' VarName '(indgood))./nbaver(indgood);'])
     448            end
     449        else
     450            for ivar=VarIndex
     451                VarName=MergeData.ListVarName{ivar};
     452                eval(['MergeData.' VarName '=double(MergeData.' VarName ')./nbview;'])
     453            end   
     454        end
     455    end
     456end
     457   
  • trunk/src/series/sub_background.m

    r54 r89  
    6565FileType=[];%default
    6666MovieObject=[];
     67FileExt=Series.FileExt;
     68
    6769if isequal(lower(FileExt),'.avi')
    6870    hhh=which('mmreader');
     
    7880   form=imformats(FileExt(2:end));
    7981   if ~isempty(form)% if the extension corresponds to an image format recognized by Matlab
    80        if isequal(NomType,'*');
     82       if isequal(Series.NomType,'*');
    8183           FileType='multimage';
    8284       else
     
    237239        ifile=indselect(ifield);
    238240        filename=name_generator(filebase,num_i1(ifile),num_j1(ifile),Series.FileExt,Series.NomType);
    239         Aread=read_image(filename,FileType,num_i1(ifile),movieobject);
     241        Aread=read_image(filename,FileType,num_i1(ifile),MovieObject);
    240242        Ak(:,:,ifield)=Aread;           
    241243    end
     
    272274                    ifile=indselect(ifield+step*floor(nbaver/2)+iburst-1);
    273275                    filename=name_generator(filebase,num_i1(ifile),num_j1(ifile),Series.FileExt,Series.NomType);
    274                     Aread=read_image(filename,FileType,num_i1(ifile),movieobject);
     276                    Aread=read_image(filename,FileType,num_i1(ifile),MovieObject);
    275277                    Ak(:,:,nbaver_ima-step+iburst)=Aread;
    276278                end
     
    316318%------------------------------------------------------------------------
    317319%--read images and convert them to the uint16 format used for PIV
    318 function A=read_image(filename,type_ima,num,movieobject)
     320function A=read_image(filename,type_ima,num,MovieObject)
    319321%------------------------------------------------------------------------
    320322%num is the view number needed for an avi movie
    321323switch type_ima
    322324    case 'movie'
    323         A=read(movieobject,num);
     325        A=read(MovieObject,num);
    324326    case 'avi'
    325327        mov=aviread(filename,num);
Note: See TracChangeset for help on using the changeset viewer.