Changeset 444 for trunk/src


Ignore:
Timestamp:
Jun 7, 2012, 9:56:19 AM (12 years ago)
Author:
sommeria
Message:

masks and calibration updated to fit with the new conventions on file organisation.
bug corrected in mouse_up (object creation)
bug corrected in civ in mode TESTciv

Location:
trunk/src
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/civ.m

    r441 r444  
    39583958    Data.ListVarName={'ny','nx','A'};
    39593959    Data.VarDimName= {'ny','nx',{'ny','nx'}};
     3960
    39603961    Data.A=imread(filecell.ima1.civ1{1}); % read the first image
    39613962    if ndims(Data.A)==3 %case of color image
     
    39663967    Data.CoordUnit='pixel';% used to set equal scaling for x and y in image dispaly
    39673968    par_civ1=read_GUI(handles.Civ1);
     3969    par_civ1.FileTypeA=get_file_type(filecell.ima1.civ1{1});
    39683970    par_civ1.ImageWidth=size(Data.A,2);
    39693971    par_civ1.ImageHeight=size(Data.A,1);
  • trunk/src/civ_matlab.m

    r437 r444  
    9797        end
    9898    else
    99         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            
     99        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           
    101100            [Field,ParamOut,errormsg] = read_field(par_civ1.ImageA,par_civ1.FileTypeA,[],par_civ1.FrameIndexA);
    102101            if ~isempty(errormsg)
     
    106105            par_civ1.ImageA=Field.A;%= image matrix A in the first input field
    107106        end
    108         if isfield(par_civ1,'ImageB')%&& (ischar(par_civ1.ImageB)||strcmp(class(par_civ1.ImageA),'VideoReader'))
     107        if isfield(par_civ1,'ImageB')&& (ischar(par_civ1.ImageB)||strcmp(class(par_civ1.ImageA),'VideoReader'))
    109108            [Field,ParamOut,errormsg] = read_field(par_civ1.ImageB,par_civ1.FileTypeB,[],par_civ1.FrameIndexB);
    110109            if ~isempty(errormsg)
  • trunk/src/geometry_calib.m

    r379 r444  
    234234%     testhandle=1;
    235235    RootPath=get(hhuvmat.RootPath,'String');
    236     RootFile=get(hhuvmat.RootFile,'String');
    237     filebase=fullfile(RootPath,RootFile);
    238     outputfile=[filebase '.xml'];%xml file associated with the currently displayed image
     236    SubDir=get(hhuvmat.SubDir,'String');
     237%     RootFile=get(hhuvmat.RootFile,'String');
     238%     filebase=fullfile(RootPath,RootFile);
     239    outputfile=[fullfile(RootPath,SubDir) '.xml'];%xml file associated with the currently displayed image
    239240else
    240241    question={'save the calibration data and point coordinates in'};
  • trunk/src/mouse_up.m

    r432 r444  
    5555%% finalize the fabrication or the translation/deformation of an object and plot the corresponding projected field
    5656if ~isempty(huvmat) && isfield(AxeData,'Drawing') && ~isequal(AxeData.Drawing,'off') && isfield(AxeData,'CurrentObject')...
    57            && ~isempty(AxeData.CurrentObject) && ishandle(AxeData.CurrentObject)
     57        && ~isempty(AxeData.CurrentObject) && ishandle(AxeData.CurrentObject)
    5858    xy=get(currentaxes,'CurrentPoint');%xy(1,1),xy(1,2): current x,y positions in axes coordinates
    59     PlotData=get(AxeData.CurrentObject,'UserData');%get data attached to the current projection object 
     59    PlotData=get(AxeData.CurrentObject,'UserData');%get data attached to the current projection object
    6060    IndexObj=PlotData.IndexObj;
    61     ObjectData=UvData.Object{IndexObj};   
    62 %     ObjectData.enable_plot=1;
    63     if strcmp(ObjectData.Type,'rectangle')||strcmp(ObjectData.Type,'ellipse')
    64         NbDefPoint=1; 
    65     elseif strcmp(ObjectData.Type,'line')|| strcmp(ObjectData.Type,'plane');
    66         NbDefPoint=2;
    67     else
    68          NbDefPoint=3;
    69     end
     61    ObjectData=UvData.Object{IndexObj};
     62    check_multiple=0;
    7063    % ending translation
    7164    if isequal(AxeData.Drawing,'translate')
     
    8275        ObjectData.Coord(ind_move,2)=xy(1,2);
    8376       
    84     %creating object   
    85     else   
     77    %creating object
     78    else
    8679        switch ObjectData.Type
    8780            case {'line'}
     
    9184                    xy(1,3)=0; % z coordinate set to 0 by default
    9285                end
    93 %                 if ~isequal(ObjectData.Coord,xy(1,:))
    94                      if ~isequal(ObjectData.Coord(end,1:2),xy(1,1:2))
     86                %                 if ~isequal(ObjectData.Coord,xy(1,:))
     87                if ~isequal(ObjectData.Coord(end,1:2),xy(1,1:2))
    9588                    ObjectData.Coord=[ObjectData.Coord ;xy(1,1:2)];% append the second point of the line if different from the first one
    96                      end
    97 %                 end
     89                end
     90                %                 end
    9891            case {'rectangle','ellipse','volume'}
    9992                XYData=AxeData.CurrentOrigin;
     
    112105                    end
    113106                end
     107            otherwise
     108                check_multiple=1;
    114109        end
    115110    end
     
    123118        set(hh_set_object.num_RangeY_2,'String',num2str(ObjectData.RangeY,4));
    124119    end
    125     if NbDefPoint<=2 || isequal(get(currentfig,'SelectionType'),'alt') ||...
    126               strcmp(AxeData.Drawing,'translate') || strcmp(AxeData.Drawing,'deform');%stop drawing
     120
     121    %stop drawing and plot projected field if the object manipulation is finished
     122    if check_multiple==0  || isequal(get(currentfig,'SelectionType'),'alt')
    127123        AxeData.CurrentOrigin=[]; %suppress the current origin
    128        if isequal(ObjectData.Type,'line') && size(ObjectData.Coord,1)>=2
    129            AxeData.Drawing='off';
    130            set(currentaxes,'UserData',AxeData);
    131 %             return % line needs at leqst two points
    132        end
    133        if  ~isempty(ObjectData)
    134 %              testmask=0;
    135 %              hmask=findobj(huvmat,'Tag','makemask');
    136 %              if ~isempty(hmask)
    137 %                 testmask=get(hmask,'Value');
    138 %              end
    139 
    140             %% update the object representation
    141 %             ObjectData.DisplayHandle_uvmat=UvData.Object{IndexObj}.DisplayHandle_uvmat;
    142 %             ObjectData.DisplayHandle_view_field=UvData.Object{IndexObj}.DisplayHandle_view_field;
    143 %             UvData.Object{IndexObj}=ObjectData;%update the current object properties
    144 %             hhuvmat=guidata(huvmat);
    145 %             IndexObj_1=get(hhuvmat.ListObject_1,'Value');
    146 %             IndexObj_2=get(hhuvmat.ListObject,'Value');
    147 %             UvData.Object=update_obj(UvData,IndexObj_1,IndexObj_2);
    148 
    149             %% plot the field projected on the object
     124%         if isequal(ObjectData.Type,'line') && size(ObjectData.Coord,1)>=2
     125% %             AxeData.Drawing='off';
     126% %             set(currentaxes,'UserData',AxeData);
     127%             
     128%         end
     129        if  ~isempty(ObjectData)
     130            %              testmask=0;
     131            %              hmask=findobj(huvmat,'Tag','makemask');
     132            %              if ~isempty(hmask)
     133            %                 testmask=get(hmask,'Value');
     134            %              end
     135           
     136            % plot the field projected on the object
    150137            ProjData= proj_field(UvData.Field,ObjectData);%project the current interface field on ObjectData
    151138            if ~isempty(ProjData)
    152139                if strcmp(tagfig,'uvmat')% uvmat plot selected, projection plot seen in view_field
    153                      hview_field=findobj(allchild(0),'tag','view_field');
     140                    hview_field=findobj(allchild(0),'tag','view_field');
    154141                    if isempty(hview_field)
    155142                        hview_field=view_field(ProjData); %open the view_field GUI for plot
     
    160147                    end
    161148                    ViewFieldData=get(hview_field,'UserData');
    162 %                     ViewFieldData.axes3=ProjData;
     149                    %                     ViewFieldData.axes3=ProjData;
    163150                    haxes=findobj(hview_field,'tag','axes3');
    164151                    if strcmp(get(haxes,'Visible'),'off')%sempty(PlotParam.Coordinates)% case of no plot display (pure text table)
     
    172159                        set(hview_field,'Position',ViewFieldData.GUISize)
    173160                    end
    174                    
    175 %                     Data=get(hview_field,'UserData');
    176 %                     if isempty(hview_field)
    177 %                         hview_field=view_field(ProjData);
    178 %                     else
    179 %                        hhview_field=guidata(hview_field);
    180 %                        [PlotType,PlotParam]=plot_field(ProjData,hhview_field.axes3,read_GUI(hview_field));%update an existing field plot
    181 %                         write_plot_param(hhview_field,PlotParam); %update the display of plotting parameters for the current object
    182 %                     end
    183 %                     ViewFieldData=get(hview_field,'UserData');
    184 %                     ViewFieldData.axes3=ProjData;
    185 %                     set(hview_field,'UserData',ViewFieldData)
    186161                else
    187162                    UvData.axes3=ProjData;
     
    189164                    write_plot_param(hhuvmat,PlotParam); %update the display of plotting parameters for the current object
    190165                end
    191                 %[PlotType,PlotParam]=plot_field(ProjData,hh_plotfield.axes3,read_plot_param(hh_plotfield));%update an existing field plot
    192 
    193166            end
    194167            set(hhuvmat.ViewField,'Value',1);%
     
    199172            set(hhuvmat.MenuEdit,'Enable','on');%
    200173        end
    201     end   
    202        AxeData.CurrentOrigin=[xy(1,1) xy(1,2)]; %the current point becomes the new current origin
    203        test_drawing=1;%allow continuation of drawing object
    204        UvData.Object{IndexObj}=ObjectData;
    205 %     end
     174    else
     175        test_drawing=1;%allow continuation of drawing object
     176        AxeData.CurrentOrigin=[xy(1,1) xy(1,2)]; %the current point becomes the next current origin
     177    end
     178    UvData.Object{IndexObj}=ObjectData;
    206179    hother=findobj('Tag','deformpoint');%find all the deformpoints
    207     set(hother,'Color','b');%reset all the deformpoints in 'blue'
    208 else
    209     test_drawing=0;
     180    set(hother,'Color','b');%reset all the deformpoints in 'blue'
    210181end
    211182
  • trunk/src/uvmat.m

    r441 r444  
    13591359            errormsg='no file browsed';
    13601360        end
    1361         [RootDir,tild,RootFile,tild,tild,tild,tild,tild,Mask.NomType]=fileparts_uvmat(maskname);
    1362 %         [RootDir,RootFile,x1,x2,xa,xb,xext,Mask.NomType]=name2display(maskname);
    1363         Mask.Base=fullfile(RootDir,RootFile);
     1361        [RootDir,SubDir,RootFile,tild,tild,tild,tild,tild,Mask.NomType]=fileparts_uvmat(maskname);
     1362        Mask.Base=fullfile(RootDir,SubDir,RootFile);
    13641363        Mask.NbSlice=1;
    13651364        set(handles.CheckMask,'UserData',Mask);
     
    13981397[RootPath,RootFile]=fileparts(MaskData.Base);
    13991398MaskName=fullfile_uvmat(RootPath,'',RootFile,'.png',MaskData.NomType,num_i1_mask,[],num_j1);
    1400 %MaskName=name_generator(MaskData.Base,num_i1_mask,num_j1,'.png',MaskData.NomType);
    1401 % huvmat=get(handles.CheckMask,'parent');
    14021399UvData=get(handles.uvmat,'UserData');
    14031400%update mask image if the mask is new
     
    47164713    %mask name
    47174714    RootPath=get(handles.RootPath,'String');
     4715    SubDir=get(handles.SubDir,'String');
    47184716    RootFile=get(handles.RootFile,'String');
    47194717    if ~isempty(RootFile)&&(isequal(RootFile(1),'/')|| isequal(RootFile(1),'\'))
    47204718        RootFile(1)=[];
    47214719    end
    4722     filebase=fullfile(RootPath,RootFile);
     4720   % filebase=fullfile(RootPath,RootFile);
    47234721    list=get(handles.masklevel,'String');
    47244722    masknumber=num2str(length(list));
    47254723    maskindex=get(handles.masklevel,'Value');
    4726     mask_name=fullfile_uvmat(RootPath,'',[RootFile '_' masknumber 'mask'],'.png','_1',maskindex);
    4727     %mask_name=name_generator([filebase '_' masknumber 'mask'],maskindex,1,'.png','_i');
     4724   % mask_name=fullfile_uvmat(RootPath,'',[RootFile '_' masknumber 'mask'],'.png','_1',maskindex);
     4725    mask_name=fullfile_uvmat(RootPath,[SubDir '.mask'],'mask','.png','_1',maskindex);
    47284726    imflag=uint8(255*(0.392+0.608*flag));% =100 for flag=0 (vectors not computed when 20<imflag<200)
    47294727    imflag=flipdim(imflag,1);
     
    47404738        mask_dir=fileparts(answer);
    47414739        if ~exist(mask_dir,'dir')
    4742             msgbox_uvmat('ERROR',['directory ' mask_dir ' does not exist'])
    4743             return
     4740            [xx,msg1]=mkdir(mask_dir);
     4741            if ~strcmp(msg1,'')
     4742                errormsg=['cannot create ' mask_dir ': ' msg1];%error message for directory creation
     4743                return
     4744            end
    47444745        end
    47454746        imwrite(imflag,answer,'BitDepth',8);
    47464747    end
    47474748    set(handles.ListObject,'Value',1)
    4748 %     set(handles.ListObject,'Max',1)
    47494749end
    47504750
Note: See TracChangeset for help on using the changeset viewer.