Ignore:
Timestamp:
Jun 25, 2012, 12:14:16 AM (12 years ago)
Author:
sommeria
Message:

functions adpated to mode background

File:
1 edited

Legend:

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

    r470 r474  
    3131%                      each line decomposed as {RootPath,SubDir,Rootfile,NomType,Extension}
    3232%    .OutputSubDir: name of the subdirectory for data outputs
    33 %    .OutputDir: directory for data outputs, including path
     33%    .OutputDirExt: directory extension for data outputs
    3434%    .Action: .ActionName: name of the current activated function
    3535%             .ActionPath:   path of the current activated function
     
    5050%% set the input elements needed on the GUI series when the action is selected in the menu ActionName
    5151if ~exist('Param','var') % case with no input parameter
    52     ParamOut={'NbViewMax';2;...% max nbre of input file series (default='' , no limitation)
    53         'AllowInputSort';'off';...% allow alphabetic sorting of the list of input files (options 'off'/'on', 'off' by default)
     52    ParamOut={'AllowInputSort';'off';...% allow alphabetic sorting of the list of input files (options 'off'/'on', 'off' by default)
    5453        'WholeIndexRange';'off';...% prescribes the file index ranges from min to max (options 'off'/'on', 'off' by default)
    5554        'NbSlice';'on'; ...%nbre of slices ('off' by default)
     
    6463end
    6564
    66 %%%%%%%%%%%% STANDARD PART (DO NOT EDIT) %%%%%%%%%%%%
     65%%%%%%%%%%%%  STANDARD PART %%%%%%%%%%%%
    6766%% select different modes,  RUN, parameter input, BATCH
    6867% BATCH  case: read the xml file for batch case
     
    8180end
    8281ParamOut=Param; %default output
    83 
     82OutputDir=[Param.OutputSubDir Param.OutputDirExt];
     83   
    8484%% root input file(s) and type
    8585RootPath=Param.InputTable(:,1);
     
    8888NomType=Param.InputTable(:,4);
    8989FileExt=Param.InputTable(:,5);
    90 
    91 % get the set of input file names (cell array filecell), and the lists of
    92 % input file or frame indices i1_series,i2_series,j1_series,j2_series
    9390[filecell,i1_series,i2_series,j1_series,j2_series]=get_file_series(Param);
    94 % filecell{iview,fileindex}: cell array representing the list of file names
     91%%%%%%%%%%%%
     92% The cell array filecell is the list of input file names, while
     93% filecell{iview,fileindex}:
    9594%        iview: line in the table corresponding to a given file series
    9695%        fileindex: file index within  the file series,
    9796% i1_series(iview,ref_j,ref_i)... are the corresponding arrays of indices i1,i2,j1,j2, depending on the input line iview and the two reference indices ref_i,ref_j
    9897% i1_series(iview,fileindex) expresses the same indices as a 1D array in file indices
    99 % set of frame indices used for movie or multimage input
    100 % numbers of slices and file indices
    101 
     98%%%%%%%%%%%%
    10299NbSlice=1;%default
    103100if isfield(Param.IndexRange,'NbSlice')&&~isempty(Param.IndexRange.NbSlice)
     
    140137%% coordinate transform or other user defined transform
    141138transform_fct='';%default
    142 if isfield(Param,'FieldTransform')&&isfield(Param.FieldTransform,'TransformHandle')
    143     transform_fct=Param.FieldTransform.TransformHandle;
    144 end
     139if isfield(Param,'FieldTransform')
     140    addpath(Param.FieldTransform.TransformPath)
     141    transform_fct=str2func(Param.FieldTransform.TransformName);
     142    rmpath(Param.FieldTransform.TransformPath)
     143end
     144
    145145%%%%%%%%%%%% END STANDARD PART  %%%%%%%%%%%%
    146146 % EDIT FROM HERE
     
    160160end
    161161NomTypeOut='_1-2_1';% output file index will indicate the first and last ref index in the series
    162 if NbSlice~=nbfield_j
    163     answer=msgbox_uvmat('INPUT_Y-N',['will not average slice by slice: for so cancel and set NbSlice= ' num2str(nbfield_j)]);
    164     if ~strcmp(answer,'Yes')
    165         return
    166     end
     162if checkrun==1
     163    return % stop here for input checks
    167164end
    168165
     
    185182end
    186183
    187 %% Initiate output fields
    188 % %initiate the output structure as a copy of the first input one (reproduce fields)
    189 % [DataOut,ParamOut,errormsg] = read_field(filecell{1,1},FileType{1},InputFields{1},1);
    190 % if ~isempty(errormsg)
    191 %     msgbox_uvmat('ERROR',['error reading ' filecell{1,1} ': ' errormsg])
    192 %     return
    193 % end
    194 % time_1=[];
    195 % if isfield(DataOut,'Time')
    196 %     time_1=DataOut.Time(1);
    197 % end
    198 % if CheckNc{iview}
    199 %     if isempty(strcmp('Conventions',DataOut.ListGlobalAttribute))
    200 %         DataOut.ListGlobalAttribute=['Conventions' DataOut.ListGlobalAttribute];
    201 %     end
    202 %     DataOut.Conventions='uvmat';
    203 %     DataOut.ListGlobalAttribute=[DataOut.ListGlobalAttribute {Param.Action}];
    204 %     ActionKey='Action';
    205 %     while isfield(DataOut,ActionKey)
    206 %         ActionKey=[ActionKey '_1'];
    207 %     end
    208 %     DataOut.(ActionKey)=Param.Action;
    209 %     DataOut.ListGlobalAttribute=[DataOut.ListGlobalAttribute {ActionKey}];
    210 %     if isfield(DataOut,'Time')
    211 %         DataOut.ListGlobalAttribute=[DataOut.ListGlobalAttribute {'Time','Time_end'}];
    212 %     end
    213 % end
    214 
    215184%% MAIN LOOP ON SLICES
    216185%%%%%%%%%%%%% STANDARD PART (DO NOT EDIT) %%%%%%%%%%%%
     
    219188    nbfiles=0;
    220189    nbmissing=0;
    221    
    222     %initiate result fields
    223 %     for ivar=1:length(DataOut.ListVarName)
    224 %         DataOut.(DataOut.ListVarName{ivar})=0; % initialise all fields to zero
    225 %     end
    226    
     190
    227191    %%%%%%%%%%%%%%%% loop on field indices %%%%%%%%%%%%%%%%
    228192    for index=index_slice
     
    350314   
    351315    %writing the result file
    352     OutputFile=fullfile_uvmat(RootPath{1},Param.OutputSubDir,RootFile{1},FileExtOut,NomTypeOut,i1_series{1}(1),i1_series{1}(end),i_slice,[]);
     316    OutputFile=fullfile_uvmat(RootPath{1},OutputDir,RootFile{1},FileExtOut,NomTypeOut,i1_series{1}(1),i1_series{1}(end),i_slice,[]);
    353317    if CheckImage{1} %case of images
    354318        if isequal(FileInfo{1}.BitDepth,16)||(numel(FileInfo)==2 &&isequal(FileInfo{2}.BitDepth,16))
Note: See TracChangeset for help on using the changeset viewer.