Ignore:
Timestamp:
Mar 12, 2025, 12:35:15 PM (2 days ago)
Author:
sommeria
Message:

background image introduced for civ1

File:
1 edited

Legend:

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

    r1175 r1176  
    256256
    257257%% introduce input image transform
     258transform_fct=[];%default, no transform
    258259if isfield(Param,'FieldTransform')&&~isempty(Param.FieldTransform.TransformName)
    259260        addpath(Param.FieldTransform.TransformPath)
     
    265266%%%%% MAIN LOOP %%%%%%
    266267maskoldname='';% initiate the mask name
     268backgroundoldname='';
    267269FileType_A='';
    268270FileType_B='';
     
    384386            end
    385387        end
     388
     389 % case of background image to subtract
     390        if par_civ1.CheckBackground &&~isempty(par_civ1.Background)
     391            [RootPath_background,SubDir_background,RootFile_background,~,~,~,~,Ext_background]=fileparts_uvmat(Param.ActionInput.Civ1.Background);
     392            j1=1;
     393            if ~isempty(j1_series_Civ1)
     394                j1=j1_series_Civ1(ifield);
     395            end
     396            if ~isempty(i2_series_Civ1)% case of volume,backgrounds act on different j levels
     397                backgroundname=fullfile_uvmat(RootPath_background,SubDir_background,RootFile_background,Ext_background,'_1',j1);
     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=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=par_civ1.ImageA-par_civ1.Background;
     427            par_civ1.ImageB=par_civ1.ImageB-par_civ1.Background;
     428        end
     429
     430
    386431        %% user defined image transform
    387432        if ~isempty(transform_fct)
     
    472517            end
    473518        end
    474        
     519
    475520        % case of input grid
    476521        if par_civ1.CheckGrid &&~isempty(par_civ1.Grid)
Note: See TracChangeset for help on using the changeset viewer.