Changeset 739 for trunk/src/series


Ignore:
Timestamp:
Apr 14, 2014, 11:42:43 AM (11 years ago)
Author:
sommeria
Message:

test on the existence of a projection grid introduced for images as input of merge_proj

File:
1 edited

Legend:

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

    r716 r739  
    5757    first_j=[];
    5858    if isfield(Param.IndexRange,'first_j'); first_j=Param.IndexRange.first_j; end
    59     last_j=[];
    60     if isfield(Param.IndexRange,'last_j'); last_j=Param.IndexRange.last_j; end
    6159    PairString='';
    6260    if isfield(Param.IndexRange,'PairString'); PairString=Param.IndexRange.PairString; end
     
    132130    end
    133131end
     132if NbView >1 && max(cell2mat(CheckImage))>0 && ~isfield(Param,'ProjObject')
     133    disp_uvmat('ERROR','projection on a common grid is needed to concatene images: use a Projection Object of type ''plane'' with ProjMode=''interp_lin''',checkrun)
     134    return
     135end
    134136
    135137%% calibration data and timing: read the ImaDoc files
     
    225227        [Data{iview},tild,errormsg] = read_field(filecell{iview,index},FileType{iview},Param.InputFields,frame_index{iview}(index));
    226228        if ~isempty(errormsg)
    227             disp(['ERROR in merge_proj/read_field/' errormsg])
     229            disp_uvmat(['ERROR in merge_proj/read_field/' errormsg],checkrun)
    228230            return
    229231        end
     
    253255            [Data{iview},errormsg]=proj_field(Data{iview},Param.ProjObject);
    254256            if ~isempty(errormsg)
    255                 disp(['ERROR in merge_proge/proj_field: ' errormsg])
     257                disp_uvmat(['ERROR in merge_proge/proj_field: ' errormsg],checkrun)
    256258                return
    257259            end
     
    266268
    267269    %% merge the NbView fields
    268     MergeData=merge_field(Data);
    269     if isfield(MergeData,'Txt')
    270         disp(MergeData.Txt);
     270    [MergeData,errormsg]=merge_field(Data);
     271    if ~isempty(errormsg)
     272        disp_uvmat('ERROR',errormsg,checkrun);
    271273        return
    272274    end
     
    361363        error=struct2nc(OutputFile,MergeData);%save result file
    362364        if isempty(error)
    363             display(['output file ' OutputFile ' written'])
     365            disp(['output file ' OutputFile ' written'])
    364366        else
    365             display(error)
     367            disp(error)
    366368        end
    367369    end
     
    371373%'merge_field': concatene fields
    372374%------------------------------------------------------------------------
    373 function MergeData=merge_field(Data)
     375function [MergeData,errormsg]=merge_field(Data)
    374376%% default output
    375377if isempty(Data)||~iscell(Data)
     
    377379    return
    378380end
    379 error=0;
     381errormsg='';
    380382MergeData=Data{1};% merged field= first field by default, reproduces the glabal attributes of the first field
    381383NbView=length(Data);
     
    386388%% group the variables (fields of 'Data') in cells of variables with the same dimensions
    387389[CellInfo,NbDim,errormsg]=find_field_cells(Data{1});
     390if ~isempty(errormsg)
     391    return
     392end
    388393
    389394%LOOP ON GROUPS OF VARIABLES SHARING THE SAME DIMENSIONS
     
    417422                            MergeData.(VarName)=Data{1}.(VarName);% correct the field of MergeData
    418423                            NbAver=~check_bad;% initiate NbAver: the nbre of good data for each point
    419                         else
     424                        elseif size(Data{iview}.(VarName))~=size(MergeData.(VarName))
     425                            errormsg='sizes of the input matrices do not agree, need to interpolate on a common grid using a projection object';
     426                            return
     427                        else                     
    420428                            MergeData.(VarName)=MergeData.(VarName) + Data{iview}.(VarName);%add data
    421429                            NbAver=NbAver + ~check_bad;% add 1 for good data, 0 else
Note: See TracChangeset for help on using the changeset viewer.