Ignore:
Timestamp:
Mar 24, 2026, 5:38:30 PM (2 days ago)
Author:
sommeria
Message:

civ repaired

File:
1 edited

Legend:

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

    r1202 r1203  
    390390            [par_civ1.ImageB,VideoObject_B] = read_image(ImageName_B,FileType_B,VideoObject_B,FrameIndex_B);
    391391           
    392        
    393         % case of background image to subtract
    394         if par_civ1.CheckBackground &&~isempty(par_civ1.Background)
    395             [RootPath_background,SubDir_background,RootFile_background,~,~,~,~,Ext_background]=fileparts_uvmat(Param.ActionInput.Civ1.Background);
    396             if strcmp(NomTypeNc,'_1-2_1')% case of volume,backgrounds act on different j levels
    397                 backgroundname=fullfile_uvmat(RootPath_background,SubDir_background,RootFile_background,Ext_background,'_1',j1_series_Civ1(ifield));
    398             elseif isfield(par_civ1,'NbSlice')
    399                 i1_background=mod(i1-1,par_civ1.NbSlice)+1;
    400                 backgroundname=fullfile_uvmat(RootPath_background,SubDir_background,RootFile_background,Ext_background,'_1',i1_background);
    401                 if strcmp(Param.ActionInput.PairIndices.ListPairMode,'series(Di)')% case of volume, background index refers to j index
    402                     par_civ1.NbSlice_j=par_civ1.NbSlice;
    403                 end
    404             else
    405                 backgroundname=Param.ActionInput.Civ1.Background;
    406             end
    407             if strcmp(backgroundoldname,backgroundname)% background exist, not already read in civ1
    408                 par_civ1.Background=background; %use background already opened
    409             else
    410                 if ~isempty(regexp(backgroundname,'(^http://)|(^https://)', 'once'))|| exist(backgroundname,'file')
    411                     try
    412                         par_civ1.Background=uint16(imread(backgroundname));%update the background, an store it for future use
    413                     catch ME
    414                         if ~isempty(ME.message)
    415                             errormsg=['error reading input image: ' ME.message];
    416                             disp_uvmat('ERROR',errormsg,checkrun)
    417                             return
    418                         end
    419                     end
    420                 else
    421                     par_civ1.Background=[];
    422                 end
    423                 background=par_civ1.Background;
    424                 backgroundoldname=backgroundname;
    425             end
    426             par_civ1.ImageA=uint16(par_civ1.ImageA)-par_civ1.Background;
    427             par_civ1.ImageB=uint16(par_civ1.ImageB)-par_civ1.Background;
    428         end
    429        
    430         % case of image luminosity rescaling
    431         if par_civ1.CheckRescale &&~isempty(par_civ1.Maxtanh)
    432             par_civ1.ImageA =par_civ1.Maxtanh*tanh(double(par_civ1.ImageA)/par_civ1.Maxtanh);
    433             par_civ1.ImageB=par_civ1.Maxtanh*tanh(double(par_civ1.ImageB)/par_civ1.Maxtanh);
    434         end
    435        
    436392        % par_civ1.ImageWidth=size(par_civ1.ImageA,2);
    437393        % par_civ1.ImageHeight=size(par_civ1.ImageA,1);
     
    467423        Data.ListGlobalAttribute=[ListGlobalAttribute Civ1_param];
    468424        Data.CivStage=1;
     425           
     426           
     427           
     428        % case of background image to subtract
     429        if par_civ1.CheckBackground &&~isempty(par_civ1.Background)
     430            [RootPath_background,SubDir_background,RootFile_background,~,~,~,~,Ext_background]=fileparts_uvmat(Param.ActionInput.Civ1.Background);
     431            if strcmp(NomTypeNc,'_1-2_1')% case of volume,backgrounds act on different j levels
     432                backgroundname=fullfile_uvmat(RootPath_background,SubDir_background,RootFile_background,Ext_background,'_1',j1_series_Civ1(ifield));
     433            elseif isfield(par_civ1,'NbSlice')
     434                i1_background=mod(i1-1,par_civ1.NbSlice)+1;
     435                backgroundname=fullfile_uvmat(RootPath_background,SubDir_background,RootFile_background,Ext_background,'_1',i1_background);
     436                if strcmp(Param.ActionInput.PairIndices.ListPairMode,'series(Di)')% case of volume, background index refers to j index
     437                    par_civ1.NbSlice_j=par_civ1.NbSlice;
     438                end
     439            else
     440                backgroundname=Param.ActionInput.Civ1.Background;
     441            end
     442            if strcmp(backgroundoldname,backgroundname)% background exist, not already read in civ1
     443                par_civ1.Background=background; %use background already opened
     444            else
     445                if ~isempty(regexp(backgroundname,'(^http://)|(^https://)', 'once'))|| exist(backgroundname,'file')
     446                    try
     447                        par_civ1.Background=uint16(imread(backgroundname));%update the background, an store it for future use
     448                    catch ME
     449                        if ~isempty(ME.message)
     450                            errormsg=['error reading input image: ' ME.message];
     451                            disp_uvmat('ERROR',errormsg,checkrun)
     452                            return
     453                        end
     454                    end
     455                else
     456                    par_civ1.Background=[];
     457                end
     458                background=par_civ1.Background;
     459                backgroundoldname=backgroundname;
     460            end
     461            par_civ1.ImageA=uint16(par_civ1.ImageA)-par_civ1.Background;
     462            par_civ1.ImageB=uint16(par_civ1.ImageB)-par_civ1.Background;
     463        end
     464       
     465        % case of image luminosity rescaling
     466        if par_civ1.CheckRescale &&~isempty(par_civ1.Maxtanh)
     467            par_civ1.ImageA =par_civ1.Maxtanh*tanh(double(par_civ1.ImageA)/par_civ1.Maxtanh);
     468            par_civ1.ImageB=par_civ1.Maxtanh*tanh(double(par_civ1.ImageB)/par_civ1.Maxtanh);
     469        end
     470       
     471       
    469472       
    470473        % set the list of variables
Note: See TracChangeset for help on using the changeset viewer.