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

various bugs repaired,Relabeling frames installed for multitif

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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.