Changeset 1180 for trunk/src/series


Ignore:
Timestamp:
Mar 27, 2025, 5:59:21 PM (3 weeks ago)
Author:
sommeria
Message:

various bugs repaired,Relabeling frames installed for multitif

Location:
trunk/src/series
Files:
4 edited

Legend:

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

    r1165 r1180  
    11521152    end
    11531153    if isempty(r)
    1154         display('wrong pair mode input option')
     1154        disp('wrong pair mode input option')
    11551155    else
    11561156        ind1=stra2num(r.num1);
  • trunk/src/series/civ_input.m

    r1177 r1180  
    13781378[Path,ref.subdir,File,ref.num1,ref.num2,ref.num_a,ref.num_b,ref.ext,ref.nom_type]=fileparts_uvmat(fileinput);
    13791379ref.filebase=fullfile(Path,File);
    1380 % ref.num_a=stra2num(str_a);
    1381 % ref.num_b=stra2num(str_b);
    1382 % ref.num1=str2double(field_count);
    1383 % ref.num2=str2double(str2);
    1384 browse=[];%initialisation
     1380
     1381%browse=[];%initialisation
    13851382if ~isequal(ref.ext,'.nc')
    13861383    msgbox_uvmat('ERROR','the reference file must be in netcdf format (*.nc)')
  • trunk/src/series/civ_series.m

    r1178 r1180  
    254254    end
    255255end
     256
     257%% File relabeling documented by the xml file (e.g. PCO)
    256258CheckRelabel=isfield(Param,'FileSeries' );%=true for index relabeling (PCO)
    257259
     
    340342                ImageName_A=Param.ActionInput.RefFile;
    341343            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]);
     344            [RootFile,FrameIndex_A]=index2filename(Param.FileSeries,i1_series_Civ1(ifield),j1_series_Civ1(ifield),MaxIndex_j);
     345            ImageName_A=fullfile(RootPath_A,SubDir_A,RootFile);
    344346            else
    345347                ImageName_A=fullfile_uvmat(RootPath_A,SubDir_A,RootFile_A,FileExt_A,NomType_A,i1_series_Civ1(ifield),[],j1_series_Civ1(ifield));
     
    355357                    FileType_A=FileInfo_A.FileType;
    356358                    if isempty(Time) && ~isempty(find(strcmp(FileType_A,{'mmreader','video','cine_phantom','telopsIR'}), 1))% case of video input
    357                         Time=zeros(FileInfo_A.NumberOfFrames+1,2);                 
     359                        Time=zeros(FileInfo_A.NumberOfFrames+1,2);
    358360                        Time(:,2)=(0:1/FileInfo_A.FrameRate:(FileInfo_A.NumberOfFrames)/FileInfo_A.FrameRate)';
    359                            if ~isempty(j1_series_Civ1) && j1_series_Civ1~=1
    360                                Time=Time';
    361                            end
     361                        if ~isempty(j1_series_Civ1) && j1_series_Civ1~=1
     362                            Time=Time';
     363                        end
    362364                    end
    363365                    if ~isempty(FileType_A) && isempty(Time)% Time = index i +0.001 index j by default
     
    378380                time_input=toc(tsart_input);
    379381            end
    380 if 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]);
    383 else
    384             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);
    386 end
     382            if CheckRelabel
     383                [RootFile,FrameIndex_B]=index2filename(Param.FileSeries,i2_series_Civ1(ifield),j2_series_Civ1(ifield),MaxIndex_j);
     384                ImageName_B=fullfile(RootPath_B,SubDir_B,RootFile);
     385            else
     386                ImageName_B=fullfile_uvmat(RootPath_B,SubDir_B,RootFile_B,FileExt_B,NomType_B,i2_series_Civ1(ifield),[],j2_series_Civ1(ifield));
     387                FrameIndex_B=FrameIndex_B_Civ1(ifield);
     388            end
    387389            if isempty(FileType_B)% determine the image type for the first field
    388390                [FileInfo_B,VideoObject_B]=get_file_info(ImageName_B);
     
    394396            end
    395397            [par_civ1.ImageB,VideoObject_B] = read_image(ImageName_B,FileType_B,VideoObject_B,FrameIndex_B);
    396            
     398
    397399        catch ME % display errors in reading input images
    398400            if ~isempty(ME.message)
     
    627629            ImageName_A_Civ2=Param.ActionInput.RefFile;
    628630        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
     631            [RootFile,FrameIndex_A_2]=index2filename(Param.FileSeries,i1_series_Civ2(ifield),j1_series_Civ2(ifield),MaxIndex_j);
     632            ImageName_A_Civ2=fullfile(RootPath_A,SubDir_A,RootFile);
     633        else
    632634            ImageName_A_Civ2=fullfile_uvmat(RootPath_A,SubDir_A,RootFile_A,FileExt_A,NomType_A,i1_civ2,[],j1_civ2);
    633635            FrameIndex_A_2=FrameIndex_A_Civ2(ifield);
     
    639641        end
    640642        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 
    646         ImageName_B_Civ2=fullfile_uvmat(RootPath_B,SubDir_B,RootFile_B,FileExt_B,NomType_B,i2_civ2,[],j2_civ2);
    647         FrameIndex_B_2=FrameIndex_B_Civ2(ifield);
     643            [RootFile,FrameIndex_B_2]=index2filename(Param.FileSeries,i2_civ2,j2_civ2,MaxIndex_j);
     644            ImageName_B_Civ2=fullfile(RootPath_B,SubDir_B,RootFile);
     645        else
     646            ImageName_B_Civ2=fullfile_uvmat(RootPath_B,SubDir_B,RootFile_B,FileExt_B,NomType_B,i2_civ2,[],j2_civ2);
     647            FrameIndex_B_2=FrameIndex_B_Civ2(ifield);
    648648        end
    649649        if strcmp(ImageName_B_Civ2,ImageName_B) && isequal(FrameIndex_B_2,FrameIndex_B)
  • trunk/src/series/sub_background.m

    r1179 r1180  
    7878    ParamOut.VelType='off';% menu for selecting the velocity type (options 'off'/'one'/'two',  'off' by default)
    7979    ParamOut.FieldName='off';% menu for selecting the field (s) in the input file(options 'off'/'one'/'two', 'off' by default)
    80     ParamOut.FieldTransform = 'off';%can use a transform function
    81     ParamOut.ProjObject='off';%cannot use projection object(option 'off'/'on',
    82     ParamOut.Mask='on';%can use mask option   (option 'off'/'on', 'off' by default)
     80    ParamOut.FieldTransform = 'off';%can use a transform function (option 'off'/'on','off' by default)
     81    ParamOut.ProjObject='off';%cannot use projection object(option 'off'/'on','off' by default)
     82    ParamOut.Mask='off';%cannot use mask option   (option 'off'/'on', 'off' by default)
    8383    ParamOut.OutputDirExt='.sback';%set the output dir extension
    8484    ParamOut.OutputFileMode='NbInput';% '=NbInput': 1 output file per input file index, '=NbInput_i': 1 file per input file index i, '=NbSlice': 1 file per slice
     
    250250%% Input file info
    251251if CheckRelabel
    252       [RootFileOut,FileIndexString]=index2filename(Param.FileSeries,Param.IndexRange.first_i,j_indices(1),NbField_j);
    253        FirstFileName=fullfile(RootPath,SubDir,[RootFileOut FileIndexString FileExt]);
    254 else
    255 FirstFileName=fullfile_uvmat(RootPath,SubDir,RootFile,FileExt,NomType,Param.IndexRange.first_i,[],j_indices(1));%get first file name
    256 RootFileOut=RootFile;
     252    [RootFileOut,frame_index]=index2filename(Param.FileSeries,Param.IndexRange.first_i,j_indices(1),NbField_j);
     253    FirstFileName=fullfile(RootPath,SubDir,RootFileOut);
     254else
     255    FirstFileName=fullfile_uvmat(RootPath,SubDir,RootFile,FileExt,NomType,Param.IndexRange.first_i,[],j_indices(1));%get first file name
     256    RootFileOut=RootFile;
    257257end
    258258[FileInfo,MovieObject]=get_file_info(FirstFileName);
    259259FileType=FileInfo.FileType;
    260 if isfield(FileInfo,'NumberOfFrames') && FileInfo.NumberOfFrames >1
    261     if isempty(regexp(NomType,'1$', 'once'))% no file indexing
    262         frame_index=i_indices;% the index i denotes the frame number in a movie, no index j
     260if ~CheckRelabel
     261    if isfield(FileInfo,'NumberOfFrames') && FileInfo.NumberOfFrames >1
     262        if isempty(regexp(NomType,'1$', 'once'))% no file indexing
     263            frame_index=i_indices;% the index i denotes the frame number in a movie, no index j
     264        else
     265            frame_index=j_indices;% the index j denotes the frame number in a movie
     266            MovieObject=[]; %not a single video object
     267        end
    263268    else
    264         frame_index=j_indices;% the index j denotes the frame number in a movie
    265         MovieObject=[]; %not a single video object
    266     end
    267 else
    268     frame_index=ones(1,nbfield);
     269        frame_index=ones(1,nbfield);
     270    end
    269271end
    270272
     
    288290
    289291%% prealocate memory for the sliding background
    290 Ak=zeros(FileInfo.Height,FileInfo.Width,nbaver_ima,['uint' num2str(FileInfo.BitDepth)]); %prealocate memory   
     292Ak=zeros(FileInfo.Height,FileInfo.Width,nbaver_ima,['uint' num2str(FileInfo.BitDepth)]); %prealocate memory
    291293
    292294%% selection of frame indices
    293 if Param.ActionInput.CheckVolume 
     295if Param.ActionInput.CheckVolume
    294296    nbfield=floor(nbfield/NbSlice_j)*NbSlice_j;% truncate the total number of frames in case of incomplete series
    295297    indselect=1:nbfield;
    296      indselect=reshape(indselect,NbSlice_j,[]);
    297       NbSlice=NbSlice_j;
    298 else
    299        NbSlice=NbSlice_i;
     298    indselect=reshape(indselect,NbSlice_j,[]);
     299    NbSlice=NbSlice_j;
     300else
     301    NbSlice=NbSlice_i;
    300302    nbfield=floor(nbfield/NbSlice)*NbSlice;% truncate the total number of frames in case of incomplete series
    301303    indselect=reshape(1:nbfield,NbSlice,[]);
    302304    for j_slice=1:NbSlice
    303     indselect(j_slice,:)=j_slice:NbSlice:nbfield;% select file indices of the slice
     305        indselect(j_slice,:)=j_slice:NbSlice:nbfield;% select file indices of the slice
    304306    end
    305307end
     
    313315        %filename=filecell{1,ifile};
    314316        if CheckRelabel
    315             [RootFile,FileIndexString,FrameIndex]=index2filename(Param.FileSeries,i_indices(ifile),j_indices(ifile),NbField_j);
    316             filename=fullfile(RootPath,SubDir,[RootFile FileIndexString FileExt]);
     317            [filename,FrameIndex]=index2filename(Param.FileSeries,i_indices(ifile),j_indices(ifile),NbField_j);
     318             filename=fullfile(RootPath,SubDir,filename);
    317319        else
    318320            filename=fullfile_uvmat(RootPath,SubDir,RootFile,FileExt,NomType,i_indices(ifile),[],j_indices(ifile));
     
    368370                ifile=indselect(j_slice,ifield+iburst+step*halfnbaver);
    369371                if CheckRelabel
    370                     [RootFile,FileIndexString,FrameIndex]=index2filename(Param.FileSeries,i_indices(ifile),j_indices(ifile),NbField_j);
    371                     filename=fullfile(RootPath,SubDir,[RootFile FileIndexString FileExt]);
     372                    [filename,FrameIndex]=index2filename(Param.FileSeries,i_indices(ifile),j_indices(ifile),NbField_j);
     373                    filename=fullfile(RootPath,SubDir,filename);
    372374                else
    373375                    filename=fullfile_uvmat(RootPath,SubDir,RootFile,FileExt,NomType,i_indices(ifile),[],j_indices(ifile));
Note: See TracChangeset for help on using the changeset viewer.