Ignore:
Timestamp:
Mar 12, 2025, 8:13:18 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

    r1176 r1177  
    258258transform_fct=[];%default, no transform
    259259if isfield(Param,'FieldTransform')&&~isempty(Param.FieldTransform.TransformName)
    260         addpath(Param.FieldTransform.TransformPath)
     260       % addpath(Param.FieldTransform.TransformPath)
     261        currentdir=pwd;
     262    cd(Param.FieldTransform.TransformPath)
    261263    transform_fct=str2func(Param.FieldTransform.TransformName);
    262     rmpath(Param.FieldTransform.TransformPath)
    263 end
    264 
     264    cd (currentdir)
     265    %rmpath(Param.FieldTransform.TransformPath)
     266end
    265267
    266268%%%%% MAIN LOOP %%%%%%
     
    772774        end
    773775       
     776        % case of background image to subtract
     777        if par_civ2.CheckBackground &&~isempty(par_civ2.Background)
     778            [RootPath_background,SubDir_background,RootFile_background,~,~,~,~,Ext_background]=fileparts_uvmat(Param.ActionInput.Civ1.Background);
     779            j1=1;
     780            if ~isempty(j1_series_Civ1)
     781                j1=j1_series_Civ1(ifield);
     782            end
     783            if ~isempty(i2_series_Civ1)% case of volume,backgrounds act on different j levels
     784                backgroundname=fullfile_uvmat(RootPath_background,SubDir_background,RootFile_background,Ext_background,'_1',j1);
     785            elseif isfield(par_civ2,'NbSlice')
     786                i1_background=mod(i1-1,par_civ2.NbSlice)+1;
     787                backgroundname=fullfile_uvmat(RootPath_background,SubDir_background,RootFile_background,Ext_background,'_1',i1_background);
     788                if strcmp(Param.ActionInput.PairIndices.ListPairMode,'series(Di)')% case of volume, background index refers to j index
     789                    par_civ2.NbSlice_j=par_civ2.NbSlice;
     790                end
     791            else
     792                backgroundname=Param.ActionInput.Civ1.Background;
     793            end
     794            if strcmp(backgroundoldname,backgroundname)% background exist, not already read in civ2
     795                par_civ2.Background=background; %use background already opened
     796            else
     797                if ~isempty(regexp(backgroundname,'(^http://)|(^https://)', 'once'))|| exist(backgroundname,'file')
     798                    try
     799                        par_civ2.Background=imread(backgroundname);%update the background, an store it for future use
     800                    catch ME
     801                        if ~isempty(ME.message)
     802                            errormsg=['error reading input image: ' ME.message];
     803                            disp_uvmat('ERROR',errormsg,checkrun)
     804                            return
     805                        end
     806                    end
     807                else
     808                    par_civ2.Background=[];
     809                end
     810                background=par_civ2.Background;
     811                backgroundoldname=backgroundname;
     812            end
     813            par_civ2.ImageA=par_civ2.ImageA-par_civ2.Background;
     814            par_civ2.ImageB=par_civ2.ImageB-par_civ2.Background;
     815        end
    774816       
    775817        if strcmp(Param.ActionInput.ListCompareMode,'displacement')
Note: See TracChangeset for help on using the changeset viewer.