Changeset 452


Ignore:
Timestamp:
Jun 12, 2012, 8:53:51 PM (9 years ago)
Author:
sommeria
Message:

bugs repaired

Location:
trunk/src
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/civ.m

    r446 r452  
    21002100                detect=exist(filename,'file')==2;
    21012101                if detect% if a netcdf file already exists
    2102                     answer=msgbox_uvmat('INPUT_Y-N',['delete files in ' subdir_civ1_new]);
    2103                     if ~strcmp(answer,'Yes')
     2102                    answer=msgbox_uvmat('INPUT_Y-N',['overwrite existing civ files in ' subdir_civ1_new]);
     2103                    if strcmp(answer,'Yes')
     2104                        detect=0;
     2105                        filecell.nc.civ1(ifile,j)={filename};
     2106                    else
    21042107                        r=regexp(subdir_civ1_new,'(?<root>.*\D)(?<num1>\d+)$','names');%detect whether name ends by a number
    21052108                        if isempty(r)
  • trunk/src/civ_matlab.m

    r445 r452  
    5151check_civ1=0;%default
    5252check_patch1=0;%default
    53 
     53        ImageFileA=Param.Civ1.ImageA;
     54        ImageFileB=Param.Civ1.ImageB;
     55        if isfield(Param,'Civ2')
     56            ImageFileA_civ2=Param.Civ2.ImageA;
     57             ImageFileB_civ2=Param.Civ2.ImageB;
     58        end
    5459% case of input Param set by an xml file (batch mode)
    5560if ischar(Param)
     
    98103    else
    99104        if isfield(par_civ1,'ImageA')&&(ischar(par_civ1.ImageA)||strcmp(class(par_civ1.ImageA),'VideoReader')) % case with no image: only the PIV grid is calculated           
    100             [Field,ParamOut,errormsg] = read_field(par_civ1.ImageA,par_civ1.FileTypeA,[],par_civ1.FrameIndexA);
     105            [Field,ParamOut,errormsg] = read_field(ImageFileA,par_civ1.FileTypeA,par_civ1.ImageA,par_civ1.FrameIndexA);
    101106            if ~isempty(errormsg)
    102107                errormsg=['error in civ_matlab/read_field:' errormsg];
     
    106111        end
    107112        if isfield(par_civ1,'ImageB')&& (ischar(par_civ1.ImageB)||strcmp(class(par_civ1.ImageB),'VideoReader'))
    108             [Field,ParamOut,errormsg] = read_field(par_civ1.ImageB,par_civ1.FileTypeB,[],par_civ1.FrameIndexB);
     113            [Field,ParamOut,errormsg] = read_field(ImageFileB,par_civ1.FileTypeB,par_civ1.ImageB,par_civ1.FrameIndexB);
    109114            if ~isempty(errormsg)
    110115                errormsg=['error in civ_matlab/read_field:' errormsg];
     
    242247    if ~isfield (Param,'Civ1') || ~strcmp(Param.Civ1.ImageA,par_civ2.ImageA)
    243248        %read first image if not already done for civ1
    244         [Field,ParamOut,errormsg] = read_field(par_civ2.ImageA,par_civ2.FileTypeA,[],par_civ2.FrameIndexA);
     249        [Field,ParamOut,errormsg] = read_field(ImageFileA_civ2,par_civ2.FileTypeA,par_civ2.ImageA,par_civ2.FrameIndexA);
    245250                    if ~isempty(errormsg)
    246251                errormsg=['error in civ_matlab/read_field:' errormsg];
     
    253258    if ~isfield (Param,'Civ1') || ~strcmp(Param.Civ1.ImageB,par_civ2.ImageB)
    254259        %read first image if not already done for civ1
    255         [Field,ParamOut,errormsg] = read_field(par_civ2.ImageB,par_civ2.FileTypeB,[],par_civ2.FrameIndexB);
     260        [Field,ParamOut,errormsg] = read_field(ImageFileB_civ2,par_civ2.FileTypeB,par_civ2.ImageB,par_civ2.FrameIndexB);
    256261         if ~isempty(errormsg)
    257262                errormsg=['error in civ_matlab/read_field:' errormsg];
  • trunk/src/read_field.m

    r450 r452  
    164164%% case of image
    165165if ~isempty(A)
     166    if isstruct(ParamOut)
    166167    ParamOut.FieldName='image';
    167168    ParamOut.FieldList={'image'};
     169    end
    168170    Npz=1;%default
    169171    npxy=size(A);
     
    178180            Field.AY=[npxy(1)-0.5 0.5];
    179181            Field.AX=[0.5 npxy(2)-0.5]; % coordinates of the first and last pixel centers
     182            if isstruct(ParamOut)
    180183            ParamOut.Npx=npxy(2);% display image size on the interface
    181184            ParamOut.Npy=npxy(1);
     185            end
    182186            Field.VarAttribute{3}.Mesh=1;
    183187        else
     
    188192            Field.AY=[npxy(2)-0.5 0.5];
    189193            Field.AX=[0.5 npxy(3)-0.5]; % coordinates of the first and last pixel centers
     194            if isstruct(ParamOut)
    190195            ParamOut.Npx=npxy(3);% display image size on the interface
    191196            ParamOut.Npy=npxy(2);
     197             end
    192198            Field.VarAttribute{4}.Mesh=1;
    193199        end
  • trunk/src/uvmat.m

    r450 r452  
    14581458            axes(handles.axes3)
    14591459            hold on   
    1460             MaskData.maskhandle=image(Mask.AX,Mask.AY,imflag,'Tag','mask','HitTest','off','AlphaData',0.6*flagmask);
     1460            size(flagmask)
     1461           % MaskData.maskhandle=image(Mask.AX,Mask.AY,imflag,'Tag','mask','HitTest','off','AlphaData',0.6*flagmask);
     1462            MaskData.maskhandle=image(Mask.AX,Mask.AY,imflag,'Tag','mask','HitTest','off','AlphaData',0.6*ones(size(flagmask)));
    14611463%             set(MaskData.maskhandle,'AlphaData',0.6*flagmask)
    14621464            set(handles.CheckMask,'UserData',MaskData)
     
    20542056            end
    20552057    end
     2058    if isstruct (ParamIn)
    20562059    ParamIn.FieldName=FieldName;
    20572060    ParamIn.VelType=VelType;
    20582061    ParamIn.GUIName='get_field';
     2062    end
    20592063    [Field{1},ParamOut,errormsg] = read_field(FileName,UvData.FileType{1},ParamIn,frame_index);
    20602064    if ~isempty(errormsg)
     
    21862190end
    21872191% display the Fields menu from the input file and pick the selected one:
     2192if isstruct(ParamOut)
    21882193field_index=strcmp(ParamOut.FieldName,ParamOut.FieldList);
    21892194set(handles.Fields,'String',ParamOut.FieldList); %update the field menu
    21902195set(handles.Fields,'Value',find(field_index,1))
     2196end
    21912197
    21922198%% update the display menu for the second velocity type (second menuline)
     
    21942200if isempty(FileName_1)
    21952201    set(handles.Fields_1,'Value',1); %update the field menu
     2202    if isstruct(ParamOut)
    21962203    set(handles.Fields_1,'String',[{''};ParamOut.FieldList]); %update the field menu
     2204    end
    21972205elseif ~test_keepdata_1
    21982206    if (~strcmp(UvData.FileType{2},'netcdf')&&~strcmp(UvData.FileType{2},'civdata')&&~strcmp(UvData.FileType{2},'civx'))|| isequal(FieldName_1,'get_field...')
     
    23852393
    23862394%% calculate scalar
    2387 if ~strcmp(ParamOut.FieldName,'get_field...')&& (strcmp(UvData.FileType{1},'civdata')||strcmp(UvData.FileType{1},'civx'))%&&~strcmp(ParamOut.FieldName,'velocity')&& ~strcmp(ParamOut.FieldName,'get_field...');% ~isequal(ParamOut.CivStage,0)%&&~isempty(FieldName)%
     2395if isstruct(ParamOut)&&~strcmp(ParamOut.FieldName,'get_field...')&& (strcmp(UvData.FileType{1},'civdata')||strcmp(UvData.FileType{1},'civx'))%&&~strcmp(ParamOut.FieldName,'velocity')&& ~strcmp(ParamOut.FieldName,'get_field...');% ~isequal(ParamOut.CivStage,0)%&&~isempty(FieldName)%
    23882396    Field{1}=calc_field([{ParamOut.FieldName} {ParamOut.ColorVar}],Field{1});
    23892397end
    2390 if numel(Field)==2 && ~strcmp(ParamOut_1.FieldName,'get_field...')&& ~test_keepdata_1 && (strcmp(UvData.FileType{2},'civdata')||strcmp(UvData.FileType{2},'civx'))  &&~strcmp(ParamOut_1.FieldName,'velocity') && ~strcmp(ParamOut_1.FieldName,'get_field...')
     2398if isstruct(ParamOut_1)&& numel(Field)==2 && ~strcmp(ParamOut_1.FieldName,'get_field...')&& ~test_keepdata_1 && (strcmp(UvData.FileType{2},'civdata')||strcmp(UvData.FileType{2},'civx'))  &&~strcmp(ParamOut_1.FieldName,'velocity') && ~strcmp(ParamOut_1.FieldName,'get_field...')
    23912399     Field{2}=calc_field([{ParamOut_1.FieldName} {ParamOut_1.ColorVar}],Field{2});
    23922400end
Note: See TracChangeset for help on using the changeset viewer.