Ignore:
Timestamp:
May 29, 2024, 7:08:52 PM (4 months ago)
Author:
sommeria
Message:

merge_proj repaired with multimask possibility

File:
1 edited

Legend:

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

    r1137 r1147  
    232232end
    233233
    234 %% mask (TODO: case of multilevels)
    235 MaskData=cell(NbView,1);
    236 if Param.CheckMask
    237     if ischar(Param.MaskTable)% case of a single mask (char chain)
    238         Param.MaskTable={Param.MaskTable};
    239     end
    240     for iview=1:numel(Param.MaskTable)
    241         if exist(Param.MaskTable{iview},'file')
    242             [MaskData{iview},tild,errormsg] = read_field(Param.MaskTable{iview},'image');
    243             if ~isempty(transform_fct) && nargin(transform_fct)>=2
    244                 MaskData{iview}=transform_fct(MaskData{iview},XmlData{iview});
    245             end
    246         end
    247     end
    248 end
    249234
    250235%% Set field names and velocity types
     
    319304        %% transform the input field iview (e.g; phys) if requested (no transform involving two input fields at this stage)
    320305        if ~isempty(transform_fct)&& checksub==0
    321             checksub=nargin(transform_fct);
    322306            if nargin(transform_fct)>=2
    323307                Data{iview}=transform_fct(Data{iview},XmlData{iview});
     
    345329       
    346330        %% mask
    347         if Param.CheckMask && ~isempty(MaskData{iview})
    348              [Data{iview},errormsg]=mask_proj(Data{iview},MaskData{iview});
     331        if Param.CheckMask % introduce multilevel mask like for civ
     332            NbSlice=Param.MaskTable{iview,2};
     333            [RootPath_mask,SubDir_mask,RootFile_mask,i1_mask,i2_mask,j1_mask,j2_mask,Ext_mask]=fileparts_uvmat(Param.MaskTable{iview,1});
     334            i1_mask=mod(i1-1,NbSlice)+1;
     335            maskname=fullfile_uvmat(RootPath_mask,SubDir_mask,RootFile_mask,Ext_mask,'_1',i1_mask);
     336            if ~exist(maskname,'file')
     337                maskname=Param.MaskTable{iview,1};
     338            end
     339            [MaskData,~,errormsg] = read_field(maskname,'image');
     340            if ~isempty(transform_fct) && nargin(transform_fct)>=2
     341                MaskData=transform_fct(MaskData,XmlData{iview});
     342            end
     343            if  ~isempty(MaskData)
     344                [Data{iview},errormsg]=mask_proj(Data{iview},MaskData);
     345            end
    349346        end
    350347    end
Note: See TracChangeset for help on using the changeset viewer.