Changeset 1197 for trunk/src/series


Ignore:
Timestamp:
Mar 11, 2026, 5:31:25 PM (4 weeks ago)
Author:
sommeria
Message:

bugs repaired

Location:
trunk/src/series
Files:
3 edited

Legend:

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

    r1196 r1197  
    276276    time_patch2=0;
    277277    if ~isempty(RUNHandle)% update the waitbar in interactive mode with GUI series  (checkrun=1)
    278         update_waitbar(WaitbarHandle,ifield/NbField)
    279278        if  checkrun && ~strcmp(get(RUNHandle,'BusyAction'),'queue')
    280279            disp('program stopped by user')
  • trunk/src/series/merge_proj.m

    r1196 r1197  
    354354            end
    355355            [MaskData,~,errormsg] = read_field(maskname,'image');
     356            if ~isempty(errormsg)
     357                disp(['error reading ' maskname ' :' errormsg])
     358                return
     359            end
    356360            if ~isempty(NbSlice_calib)
    357361                MaskData.ZIndex=mod(i1_series{iview}(index)-1,NbSlice_calib{iview})+1;%Zindex for phys transform
  • trunk/src/series/turb_correlation_x.m

    r1127 r1197  
    9494   
    9595%% root input file(s) name, type and index series
    96 RootPath=Param.InputTable(:,1);
    97 RootFile=Param.InputTable(:,3);
    98 SubDir=Param.InputTable(:,2);
    99 NomType=Param.InputTable(:,4);
    100 FileExt=Param.InputTable(:,5);
     96RootPath=Param.InputTable{:,1};
     97RootFile=Param.InputTable{:,3};
     98%SubDir=Param.InputTable(:,2);
     99NomType=Param.InputTable{1,4};
     100%FileExt=Param.InputTable(:,5);
    101101[filecell,i1_series,i2_series,j1_series,j2_series]=get_file_series(Param);
    102102%%%%%%%%%%%%
     
    108108% i1_series(iview,fileindex) expresses the same indices as a 1D array in file indices
    109109%%%%%%%%%%%% NbView=1 : a single input series
    110 NbView=numel(i1_series);%number of input file series (lines in InputTable)
     110%NbView=numel(i1_series);%number of input file series (lines in InputTable)
    111111NbField_j=size(i1_series{1},1); %nb of fields for the j index (bursts or volume slices)
    112112NbField_i=size(i1_series{1},2); %nb of fields for the i index
    113113NbField=NbField_j*NbField_i; %total number of fields
    114114
    115 %% determine the file type on each line from the first input file
    116 ImageTypeOptions={'image','multimage','mmreader','video','cine_phantom'};
    117 NcTypeOptions={'netcdf','civx','civdata'};
    118 for iview=1:NbView
    119     if ~exist(filecell{iview,1}','file')
    120         msgbox_uvmat('ERROR',['the first input file ' filecell{iview,1} ' does not exist'])
    121         return
    122     end
    123     [FileInfo{iview},MovieObject{iview}]=get_file_info(filecell{iview,1});
    124     FileType{iview}=FileInfo{iview}.FileType;
    125     CheckImage{iview}=~isempty(find(strcmp(FileType{iview},ImageTypeOptions)));% =1 for images
    126     CheckNc{iview}=~isempty(find(strcmp(FileType{iview},NcTypeOptions)));% =1 for netcdf files
    127     if ~isempty(j1_series{iview})
    128         frame_index{iview}=j1_series{iview};
    129     else
    130         frame_index{iview}=i1_series{iview};
    131     end
    132 end
    133 
    134 %% calibration data and timing: read the ImaDoc files
    135 XmlData=[];
    136 [XmlData,NbSlice_calib,time,errormsg]=read_multimadoc(RootPath,SubDir,RootFile,FileExt,i1_series,i2_series,j1_series,j2_series);
    137 if size(time,1)>1
    138     diff_time=max(max(diff(time)));
    139     if diff_time>0
    140         msgbox_uvmat('WARNING',['times of series differ by (max) ' num2str(diff_time)])
    141     end   
    142 end
    143 
    144 %% coordinate transform or other user defined transform
    145 transform_fct='';%default
    146 if isfield(Param,'FieldTransform')&&~isempty(Param.FieldTransform.TransformName)
    147     addpath(Param.FieldTransform.TransformPath)
    148     transform_fct=str2func(Param.FieldTransform.TransformName);
    149     rmpath(Param.FieldTransform.TransformPath)
    150 end
    151 
    152 %%%%%%%%%%%% END STANDARD PART  %%%%%%%%%%%%
    153  % EDIT FROM HERE
    154 
    155 %% check the validity of  input file types
    156 if CheckImage{1}
    157     FileExtOut='.png'; % write result as .png images for image inputs
    158 elseif CheckNc{1}
    159     FileExtOut='.nc';% write result as .nc files for netcdf inputs
     115%% determine the file type on each line from the first input file
     116
     117[FileInfo,MovieObject]=get_file_info(filecell{1,1});
     118FileType=FileInfo.FileType;
     119
     120if ~isempty(j1_series{1})
     121    frame_index=j1_series{1};
    160122else
    161     msgbox_uvmat('ERROR',['invalid file type input ' FileType{1}])
    162     return
    163 end
    164 
     123    frame_index=i1_series{1};
     124end
    165125
    166126%% settings for the output file
    167 NomTypeOut=nomtype2pair(NomType{1});% determine the index nomenclature type for the output file
     127FileExtOut='.nc';% write result as .nc files for netcdf inputs
     128NomTypeOut=nomtype2pair(NomType);% determine the index nomenclature type for the output file
    168129first_i=i1_series{1}(1);
    169130last_i=i1_series{1}(end);
     
    177138%% Set field names and velocity types
    178139InputFields{1}=[];%default (case of images)
    179 if isfield(Param,'InputFields')
    180     InputFields{1}=Param.InputFields;
    181 end
    182 
     140%%%%%%%%%%%%%%%%%%%%%
     141if isfield(Param.IndexRange,'TimeSource') && find(regexp(Param.IndexRange.TimeSource,'^var:'))==1
     142    Param.InputFields.TimeVarName=regexprep(Param.IndexRange.TimeSource,'^var:','');
     143end
     144%%%%%%%%%%%%%%%%%%%%
     145% if isfield(Param,'InputFields')
     146%     InputFields{1}=Param.InputFields;
     147% end
     148Param.InputFields.FieldName={'Uprime','Vprime'};
    183149nbfiles=0;
    184150nbmissing=0;
     
    197163disp('loop for mean started')
    198164for index=1:NbField
    199     update_waitbar(WaitbarHandle,index/NbField)
    200     if ~isempty(RUNHandle)&& ~strcmp(get(RUNHandle,'BusyAction'),'queue')
    201         disp('program stopped by user')
    202         break
    203     end
    204     [Field,tild,errormsg] = read_field(filecell{1,index},FileType{iview},InputFields{iview},frame_index{iview}(index));
     165    %     if ~isempty(RUNHandle)&& ~strcmp(get(RUNHandle,'BusyAction'),'queue')
     166    %         disp('program stopped by user')
     167    %         break
     168    %     end
     169    [Field,~,errormsg] = read_field(filecell{1,index},FileType,Param.InputFields,frame_index(index));
     170   
     171    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
     172    Field.U=Field.Uprime;
     173    Field.V=Field.Vprime;
     174    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    205175    if index==1 %first field
    206176        if ~isfield(Field,'U')||~isfield(Field,'V')
     
    208178            return
    209179        end
     180       
    210181        [npy,npx]=size(Field.U);
    211182        UMean=zeros(npy,npx);
    212183        VMean=zeros(npy,npx);
    213184        Counter=zeros(npy,npx);
    214                 % transcripts the global attributes
     185        % transcripts the global attributes
    215186        if isfield(Field,'ListGlobalAttribute')
    216187            DataOut.ListGlobalAttribute= Field.ListGlobalAttribute;
     
    236207disp('loop for correlation started')
    237208for index=1:NbField
    238     update_waitbar(WaitbarHandle,index/NbField)
    239209    if ~isempty(RUNHandle)&& ~strcmp(get(RUNHandle,'BusyAction'),'queue')
    240210        disp('program stopped by user')
    241211        break
    242212    end
    243     [Field,tild,errormsg] = read_field(filecell{1,index},FileType{iview},InputFields{iview},frame_index{iview}(index));
    244 
     213    [Field,~,errormsg] = read_field(filecell{1,index},FileType,Param.InputFields,frame_index(index));
     214    Field.U=Field.Uprime;
     215    Field.V=Field.Vprime;
    245216    %%%%%%%%%%%% MAIN RUNNING OPERATIONS  %%%%%%%%%%%%
    246217    if index==1 %first field
     
    281252        VVCorr(ishift+npcorr+1,:,:)=Field.V.*V_shift;
    282253        UVCorr(ishift+npcorr+1,:,:)=Field.U.*V_shift;
    283         FFCorr(ishift+npcorr+1,:,:)=FF | FF_shift;     
     254        FFCorr(ishift+npcorr+1,:,:)=FF | FF_shift;
    284255    end
    285256    DataOut.UUCorr=DataOut.UUCorr+UUCorr;
     
    322293
    323294%% writing the result file as netcdf file
    324 OutputFile=fullfile_uvmat(RootPath{1},OutputDir,RootFile{1},FileExtOut,NomTypeOut,first_i,last_i,first_j,last_j);
     295OutputFile=fullfile_uvmat(RootPath,OutputDir,RootFile,FileExtOut,NomTypeOut,first_i,last_i,first_j,last_j);
    325296 %case of netcdf input file , determine global attributes
    326297 errormsg=struct2nc(OutputFile,DataOut); %save result file
     
    331302 end
    332303
    333 
    334 %% open the result file with uvmat (in RUN mode)
    335 if checkrun
    336     uvmat(OutputFile)% open the last result file with uvmat
    337 end
Note: See TracChangeset for help on using the changeset viewer.