Ignore:
Timestamp:
Jul 29, 2024, 9:43:17 AM (2 months ago)
Author:
sommeria
Message:

civ3D updated

File:
1 edited

Legend:

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

    r1163 r1164  
    117117        if Param.ActionInput.CheckCiv1
    118118            iview_A=1;% usual PIV, the image series is on the first line of the table
    119         elseif Param.ActionInput.CheckCiv2 % civ2 is performed without Civ1, a netcdf file series is needed in the first table line
    120             iview_A=2;% the second line is used for the input images of Civ2
     119        else % Civ1 has been already stored in a netcdf file input
     120            iview_A=2;% the second line is used for the input images
    121121        end
    122122        if iview_A~=0
     
    274274    tstart=tic;
    275275    time_civ1=0;
    276   time_patch1=0;
    277   time_civ2=0;
    278   time_patch2=0;
     276    time_patch1=0;
     277    time_civ2=0;
     278    time_patch2=0;
    279279    if ~isempty(RUNHandle)% update the waitbar in interactive mode with GUI series  (checkrun=1)
    280280        update_waitbar(WaitbarHandle,ifield/NbField)
     
    335335    %% Civ1
    336336    % if Civ1 computation is requested
    337     if isfield (Param.ActionInput,'Civ1')
     337    if Param.ActionInput.CheckCiv1
    338338        if CheckInputFile
    339339            disp('civ1 started')
     
    377377                end
    378378                ImageName_B=fullfile_uvmat(RootPath_B,SubDir_B,RootFile_B,FileExt_B,NomType_B,i2_series_Civ1(ifield),[],j2_series_Civ1(ifield));
    379                     if isempty(FileType_B)% determine the image type for the first field
    380                         [FileInfo_B,VideoObject_B]=get_file_info(ImageName_B);
    381                         FileType_B=FileInfo_B.FileType;
    382                     end
    383                     if isempty(regexp(ImageName_B,'(^http://)|(^https://)', 'once')) && ~exist(ImageName_B,'file')
    384                         disp([ImageName_B ' missing'])
    385                         continue
    386                     end
    387                     [par_civ1.ImageB,VideoObject_B] = read_image(ImageName_B,FileType_B,VideoObject_B,FrameIndex_B_Civ1(ifield));
     379                if isempty(FileType_B)% determine the image type for the first field
     380                    [FileInfo_B,VideoObject_B]=get_file_info(ImageName_B);
     381                    FileType_B=FileInfo_B.FileType;
     382                end
     383                if isempty(regexp(ImageName_B,'(^http://)|(^https://)', 'once')) && ~exist(ImageName_B,'file')
     384                    disp([ImageName_B ' missing'])
     385                    continue
     386                end
     387                [par_civ1.ImageB,VideoObject_B] = read_image(ImageName_B,FileType_B,VideoObject_B,FrameIndex_B_Civ1(ifield));
    388388            catch ME % display errors in reading input images
    389389                if ~isempty(ME.message)
     
    392392                end
    393393            end
     394           
    394395            % par_civ1.ImageWidth=size(par_civ1.ImageA,2);
    395396            % par_civ1.ImageHeight=size(par_civ1.ImageA,1);
     
    425426            end
    426427            Data.ListGlobalAttribute=[ListGlobalAttribute Civ1_param];
     428           
    427429            Data.CivStage=1;
    428430        else
     
    438440        Data.VarAttribute{5}.Role='ancillary';
    439441        Data.VarAttribute{6}.Role='errorflag';
    440 
     442       
    441443        % case of mask
    442444        if par_civ1.CheckMask&&~isempty(par_civ1.Mask)
     
    451453                i1_mask=mod(i1-1,par_civ1.NbSlice)+1;
    452454                maskname=fullfile_uvmat(RootPath_mask,SubDir_mask,RootFile_mask,Ext_mask,'_1',i1_mask);
    453             else
    454                 maskname=Param.ActionInput.Civ1.Mask;
    455             end
    456             if strcmp(maskoldname,maskname)% mask exist, not already read in civ1
    457                 par_civ1.Mask=mask; %use mask already opened
    458             else
    459                 if ~isempty(regexp(maskname,'(^http://)|(^https://)', 'once'))|| exist(maskname,'file')
    460                     try
    461                         par_civ1.Mask=imread(maskname);%update the mask, an store it for future use
    462                     catch ME
    463                         if ~isempty(ME.message)
    464                             errormsg=['error reading input image: ' ME.message];
    465                             disp_uvmat('ERROR',errormsg,checkrun)
    466                             return
    467                         end
     455                if strcmp(Param.ActionInput.PairIndices.ListPairMode,'series(Di)')% case of volume, mask index refers to j index
     456                    par_civ1.NbSlice_j=par_civ1.NbSlice;
     457                end
     458            end
     459        else
     460            maskname=Param.ActionInput.Civ1.Mask;
     461        end
     462        if strcmp(maskoldname,maskname)% mask exist, not already read in civ1
     463            par_civ1.Mask=mask; %use mask already opened
     464        else
     465            if ~isempty(regexp(maskname,'(^http://)|(^https://)', 'once'))|| exist(maskname,'file')
     466                try
     467                    par_civ1.Mask=imread(maskname);%update the mask, an store it for future use
     468                catch ME
     469                    if ~isempty(ME.message)
     470                        errormsg=['error reading input image: ' ME.message];
     471                        disp_uvmat('ERROR',errormsg,checkrun)
     472                        return
    468473                    end
    469                 else
    470                     par_civ1.Mask=[];
    471                 end
    472                 mask=par_civ1.Mask;
    473                 maskoldname=maskname;
    474             end
    475         end
    476 
     474                end
     475            else
     476                par_civ1.Mask=[];
     477            end
     478            mask=par_civ1.Mask;
     479            maskoldname=maskname;
     480        end
     481       
     482       
    477483        % case of input grid
    478484        if par_civ1.CheckGrid &&~isempty(par_civ1.Grid)
     
    481487            par_civ1.CorrBoxSize=GridData.CorrBox;
    482488        end
    483 
    484         % caluclate velocity data 
     489       
     490        % caluclate velocity data
    485491        tstart_civ1=tic;
    486492        [Data.Civ1_X,Data.Civ1_Y,Data.Civ1_U,Data.Civ1_V,Data.Civ1_C,Data.Civ1_FF, result_conv, errormsg] = civ (par_civ1);
     
    489495            return
    490496        end
    491 
    492     else% we use existing Civ1 data
     497       
    493498        if exist('ncfile','var')
    494499            CivFile=ncfile;
    495             [Data,tild,tild,errormsg]=nc2struct(CivFile,'ListGlobalAttribute','absolut_time_T0'); %look for the constant 'absolut_time_T0' to detect old civx data format
    496             if ~isempty(errormsg)
    497                 disp_uvmat('ERROR',errormsg,checkrun)
    498                 return
    499             end
     500            % [Data,tild,tild,errormsg]=nc2struct(CivFile,'ListGlobalAttribute','absolut_time_T0'); %look for the constant 'absolut_time_T0' to detect old civx data format
     501            % if ~isempty(errormsg)
     502            %     disp_uvmat('ERROR',errormsg,checkrun)
     503            %     return
     504            % end
    500505            [Data,tild,tild,errormsg]=nc2struct(CivFile);%read civ1 and fix1 data in the existing netcdf file
    501506        elseif isfield(Param,'Civ1_X')
     
    510515        end
    511516    end
     517
    512518   
    513519    %% Fix1
     
    717723                i1_mask=mod(i1-1,par_civ2.NbSlice)+1;
    718724                maskname=fullfile_uvmat(RootPath_mask,SubDir_mask,RootFile_mask,Ext_mask,'_1',i1_mask);
     725                if strcmp(Param.ActionInput.PairIndices.ListPairMode,'series(Di)')% case of volume, mask index refers to j index
     726                    par_civ2.NbSlice_j=par_civ2.NbSlice;
     727                end
    719728            else
    720729                maskname=Param.ActionInput.Civ2.Mask;
     
    876885        if isempty(errormsg)
    877886            disp([ncfile_out ' written'])
    878             %[success,msg] = fileattrib(ncfile_out ,'+w','g');% done in struct2nc
    879887        else
    880888            disp(errormsg)
Note: See TracChangeset for help on using the changeset viewer.