Ignore:
Timestamp:
Mar 21, 2025, 10:17:07 AM (4 weeks ago)
Author:
sommeria
Message:

virtual frame indexing introduced

File:
1 edited

Legend:

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

    r1177 r1178  
    254254    end
    255255end
     256CheckRelabel=isfield(Param,'FileSeries' );%=true for index relabeling (PCO)
    256257
    257258%% introduce input image transform
    258259transform_fct=[];%default, no transform
    259260if isfield(Param,'FieldTransform')&&~isempty(Param.FieldTransform.TransformName)
    260        % addpath(Param.FieldTransform.TransformPath)
    261261        currentdir=pwd;
    262262    cd(Param.FieldTransform.TransformPath)
    263263    transform_fct=str2func(Param.FieldTransform.TransformName);
    264264    cd (currentdir)
    265     %rmpath(Param.FieldTransform.TransformPath)
    266265end
    267266
     
    289288    end
    290289    OutputPath=fullfile(Param.OutputPath,Param.Experiment,Param.Device);
    291 
     290    if CheckRelabel
     291         RootFileOut=index2filename(Param.FileSeries,1,1,MaxIndex_j);
     292    else
     293        RootFileOut=RootFile_A;
     294    end
    292295    if strcmp(Param.ActionInput.ListCompareMode,'PIV')
    293         ncfile=fullfile_uvmat(OutputPath,OutputDir,RootFile_A,'.nc',NomTypeNc,i1_series_Civ1(ifield),i2_series_Civ1(ifield),...
     296        ncfile=fullfile_uvmat(OutputPath,OutputDir,RootFileOut,'.nc',NomTypeNc,i1_series_Civ1(ifield),i2_series_Civ1(ifield),...
    294297            j1_series_Civ1(ifield),j2_series_Civ1(ifield));
    295298    else
    296         ncfile=fullfile_uvmat(OutputPath,OutputDir,RootFile_A,'.nc',NomTypeNc,i2_series_Civ1(ifield),[],...
     299        ncfile=fullfile_uvmat(OutputPath,OutputDir,RootFileOut,'.nc',NomTypeNc,i2_series_Civ1(ifield),[],...
    297300            j1_series_Civ1(ifield),j2_series_Civ1(ifield));
    298301    end
     
    314317        end
    315318        if strcmp(Param.ActionInput.ListCompareMode,'PIV')
    316             ncfile_out=fullfile_uvmat(OutputPath,OutputDir,RootFile_A,'.nc',NomTypeNc,i1_civ2,i2_civ2,j1_civ2,j2_civ2);
     319            ncfile_out=fullfile_uvmat(OutputPath,OutputDir,RootFileOut,'.nc',NomTypeNc,i1_civ2,i2_civ2,j1_civ2,j2_civ2);
    317320        else % displacement
    318             ncfile_out=fullfile_uvmat(OutputPath,OutputDir,RootFile_A,'.nc',NomTypeNc,i2_civ2,[],j2_civ2);
     321            ncfile_out=fullfile_uvmat(OutputPath,OutputDir,RootFileOut,'.nc',NomTypeNc,i2_civ2,[],j2_civ2);
    319322        end
    320323    end
     
    336339            if strcmp(Param.ActionInput.ListCompareMode,'displacement')
    337340                ImageName_A=Param.ActionInput.RefFile;
     341            elseif CheckRelabel
     342            [RootFile,FileIndexString,FrameIndex_A]=index2filename(Param.FileSeries,i1_series_Civ1(ifield),j1_series_Civ1(ifield),MaxIndex_j);
     343            ImageName_A=fullfile(RootPath_A,SubDir_A,[RootFile FileIndexString FileExt_A]);
    338344            else
    339345                ImageName_A=fullfile_uvmat(RootPath_A,SubDir_A,RootFile_A,FileExt_A,NomType_A,i1_series_Civ1(ifield),[],j1_series_Civ1(ifield));
     346                FrameIndex_A=FrameIndex_A_Civ1(ifield);
    340347            end
    341348            if strcmp(FileExt_A,'.nc')% case of input images in format netcdf
     
    368375                end
    369376                tsart_input=tic;
    370                 [par_civ1.ImageA,VideoObject_A] = read_image(ImageName_A,FileType_A,VideoObject_A,FrameIndex_A_Civ1(ifield));
     377                [par_civ1.ImageA,VideoObject_A] = read_image(ImageName_A,FileType_A,VideoObject_A,FrameIndex_A);
    371378                time_input=toc(tsart_input);
    372379            end
     380if CheckRelabel
     381            [RootFile,FileIndexString,FrameIndex_B]=index2filename(Param.FileSeries,i1_series_Civ1(ifield),j1_series_Civ1(ifield),MaxIndex_j);
     382            ImageName_B=fullfile(RootPath_B,SubDir_B,[RootFile FileIndexString FileExt_B]);
     383else
    373384            ImageName_B=fullfile_uvmat(RootPath_B,SubDir_B,RootFile_B,FileExt_B,NomType_B,i2_series_Civ1(ifield),[],j2_series_Civ1(ifield));
     385            FrameIndex_B=FrameIndex_B_Civ1(ifield);
     386end
    374387            if isempty(FileType_B)% determine the image type for the first field
    375388                [FileInfo_B,VideoObject_B]=get_file_info(ImageName_B);
     
    380393                continue
    381394            end
    382             [par_civ1.ImageB,VideoObject_B] = read_image(ImageName_B,FileType_B,VideoObject_B,FrameIndex_B_Civ1(ifield));
     395            [par_civ1.ImageB,VideoObject_B] = read_image(ImageName_B,FileType_B,VideoObject_B,FrameIndex_B);
    383396           
    384397        catch ME % display errors in reading input images
     
    613626        if strcmp(Param.ActionInput.ListCompareMode,'displacement')
    614627            ImageName_A_Civ2=Param.ActionInput.RefFile;
    615         else
     628        elseif CheckRelabel
     629              [RootFile,FileIndexString,FrameIndex_A_2]=index2filename(Param.FileSeries,i1_series_Civ2(ifield),j1_series_Civ2(ifield),MaxIndex_j);
     630            ImageName_A_Civ2=fullfile(RootPath_A,SubDir_A,[RootFile FileIndexString FileExt_A]);
     631            else
    616632            ImageName_A_Civ2=fullfile_uvmat(RootPath_A,SubDir_A,RootFile_A,FileExt_A,NomType_A,i1_civ2,[],j1_civ2);
    617         end
    618         if strcmp(ImageName_A_Civ2,ImageName_A) && isequal(FrameIndex_A_Civ1(ifield),FrameIndex_A_Civ2(ifield))
     633            FrameIndex_A_2=FrameIndex_A_Civ2(ifield);
     634        end
     635        if strcmp(ImageName_A_Civ2,ImageName_A) && isequal(FrameIndex_A,FrameIndex_A_2)
    619636            par_civ2.ImageA=par_civ1.ImageA;
    620637        else
    621             [par_civ2.ImageA,VideoObject_A] = read_image(ImageName_A_Civ2,FileType_A,VideoObject_A,FrameIndex_A_Civ2(ifield));
    622         end
     638            [par_civ2.ImageA,VideoObject_A] = read_image(ImageName_A_Civ2,FileType_A,VideoObject_A,FrameIndex_A_2);
     639        end
     640        if CheckRelabel
     641              [RootFile,FileIndexString,FrameIndex_B_2]=index2filename(Param.FileSeries,i2_civ2,j2_civ2,MaxIndex_j);
     642            ImageName_B_Civ2=fullfile(RootPath_B,SubDir_B,[RootFile FileIndexString FileExt_B]);
     643            else
     644
     645
    623646        ImageName_B_Civ2=fullfile_uvmat(RootPath_B,SubDir_B,RootFile_B,FileExt_B,NomType_B,i2_civ2,[],j2_civ2);
    624         if strcmp(ImageName_B_Civ2,ImageName_B) && isequal(FrameIndex_B_Civ1(ifield),FrameIndex_B_Civ2)
     647        FrameIndex_B_2=FrameIndex_B_Civ2(ifield);
     648        end
     649        if strcmp(ImageName_B_Civ2,ImageName_B) && isequal(FrameIndex_B_2,FrameIndex_B)
    625650            par_civ2.ImageB=par_civ1.ImageB;
    626651        else
    627             [par_civ2.ImageB,VideoObject_B] = read_image(ImageName_B_Civ2,FileType_B,VideoObject_B,FrameIndex_B_Civ2(ifield));
     652            [par_civ2.ImageB,VideoObject_B] = read_image(ImageName_B_Civ2,FileType_B,VideoObject_B,FrameIndex_B_2);
    628653        end
    629654        %  [FileInfo_A,VideoObject_A]=get_file_info(ImageName_A_Civ2);
Note: See TracChangeset for help on using the changeset viewer.