Changeset 315 for trunk/src/uvmat.m


Ignore:
Timestamp:
Dec 3, 2011, 10:25:45 PM (9 years ago)
Author:
sommeria
Message:

many corrections, use of the new GUI civ with mask, grid and the new matlab civ1 and fix
pivlab now included in civ_matlab which contains all matlab subfunctions for civ.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/uvmat.m

    r309 r315  
    932932%% view the field 
    933933run0_Callback(hObject, eventdata, handles); %view field
    934 mask_test=get(handles.mask_test,'value');
     934mask_test=get(handles.CheckMask,'value');
    935935if mask_test
    936     MaskData=get(handles.mask_test,'UserData');
     936    MaskData=get(handles.CheckMask,'UserData');
    937937    if isfield(MaskData,'maskhandle') && ishandle(MaskData.maskhandle)
    938938          delete(MaskData.maskhandle)    %delete old mask
    939939    end
    940     mask_test_Callback(hObject, eventdata, handles)
     940    CheckMask_Callback(hObject, eventdata, handles)
    941941end
    942942
     
    14531453
    14541454%------------------------------------------------------------------------
    1455 % --- Executes on button press in mask_test.
    1456 function mask_test_Callback(hObject, eventdata, handles)
     1455% --- Executes on button press in CheckMask.
     1456function CheckMask_Callback(hObject, eventdata, handles)
    14571457%------------------------------------------------------------------------
    14581458%case of view mask selection
    1459 if isequal(get(handles.mask_test,'Value'),1)
     1459if isequal(get(handles.CheckMask,'Value'),1)
    14601460    [FF,RootPath,FileBase]=read_file_boxes(handles);
    14611461    num_i1=stra2num(get(handles.i1,'String'));
     
    14991499                set(handles.nb_slice,'String',Name(i+1:ind_mask-1));
    15001500                set(handles.nb_slice,'BackgroundColor',[1 1 0])
    1501                 set(handles.mask_test,'UserData',Mask);
    1502                 set(handles.mask_test,'BackgroundColor',[1 1 0])
     1501                set(handles.CheckMask,'UserData',Mask);
     1502                set(handles.CheckMask,'BackgroundColor',[1 1 0])
    15031503                if nbslice > 1
    15041504                    set(handles.slices,'value',1)
     
    15221522        Mask.Base=fullfile(RootDir,RootFile);
    15231523        Mask.NbSlice=1;
    1524         set(handles.mask_test,'UserData',Mask);
    1525         set(handles.mask_test,'BackgroundColor',[1 1 0])
     1524        set(handles.CheckMask,'UserData',Mask);
     1525        set(handles.CheckMask,'BackgroundColor',[1 1 0])
    15261526    end
    15271527    if isempty(errormsg)
     
    15291529    end
    15301530    if ~isempty(errormsg)
    1531             set(handles.mask_test,'Value',0)
    1532             set(handles.mask_test,'BackgroundColor',[0.7 0.7 0.7])
     1531            set(handles.CheckMask,'Value',0)
     1532            set(handles.CheckMask,'BackgroundColor',[0.7 0.7 0.7])
    15331533     end
    1534 else
    1535     MaskData=get(handles.mask_test,'UserData');
     1534else % desactivate mask display
     1535    MaskData=get(handles.CheckMask,'UserData');
    15361536    if isfield(MaskData,'maskhandle') && ishandle(MaskData.maskhandle)
    15371537          delete(MaskData.maskhandle)   
    15381538    end
    1539     set(handles.mask_test,'UserData',[])   
     1539    set(handles.CheckMask,'UserData',[])   
    15401540    UvData=get(handles.uvmat,'UserData');
    15411541    if isfield(UvData,'MaskName')
     
    15431543        set(handles.uvmat,'UserData',UvData)
    15441544    end
    1545     set(handles.mask_test,'BackgroundColor',[0.7 0.7 0.7])
     1545    set(handles.CheckMask,'BackgroundColor',[0.7 0.7 0.7])
    15461546end
    15471547
     
    15501550%------------------------------------------------------------------------
    15511551errormsg=[];%default
    1552 MaskData=get(handles.mask_test,'UserData');
     1552MaskData=get(handles.CheckMask,'UserData');
    15531553if isfield(MaskData,'maskhandle')&& ishandle(MaskData.maskhandle)
    15541554    uistack(MaskData.maskhandle,'top');
     
    15561556num_i1_mask=mod(num_i1-1,MaskData.NbSlice)+1;
    15571557MaskName=name_generator(MaskData.Base,num_i1_mask,num_j1,'.png',MaskData.NomType);
    1558 huvmat=get(handles.mask_test,'parent');
     1558huvmat=get(handles.CheckMask,'parent');
    15591559UvData=get(huvmat,'UserData');
    15601560
     
    16231623            MaskData.maskhandle=image(Mask.AX,Mask.AY,imflag,'Tag','mask','HitTest','off','AlphaData',0.6*flagmask);
    16241624%             set(MaskData.maskhandle,'AlphaData',0.6*flagmask)
    1625             set(handles.mask_test,'UserData',MaskData)
     1625            set(handles.CheckMask,'UserData',MaskData)
    16261626        end
    16271627    end
     
    25562556
    25572557% second projection object (view_field display)
    2558 % IndexObj_2=get(handles.list_object_2,'Value');%selected projection object for the second view
    2559 % if IndexObj_2==0
    2560 %     IndexObj_2=1;
    2561 % end
    2562 %if isequal(get(handles.list_object_2,'Visible'),'on') && IndexObj_2 <= numel(UvData.Object)&& ~isempty(UvData.Object{IndexObj_2})
    2563  if length( IndexObj)>=2
    2564 %      IndexObj(2)=IndexObj_2;
     2558if length( IndexObj)>=2
    25652559    view_field_handle=findobj(allchild(0),'tag','view_field');%handles of the view_field GUI
    25662560    if ~isempty(view_field_handle)
     
    25792573    [ObjectData,errormsg]=proj_field(UvData.Field,UvData.Object{iobj});% project field on the object
    25802574    if testnewseries && isfield(ObjectData,'CoordUnit')&& isfield(PlotParam{imap},'Coordinates')
    2581         PlotParam{imap}=rmfield(PlotParam{imap}.Coordinates,'CheckFixEqual'); %set FixEqual to depend on the field (=1 if Data.CoordUnit=1 in plot_field)
     2575        PlotParam{imap}.Coordinates=rmfield(PlotParam{imap}.Coordinates,'CheckFixEqual'); %set FixEqual to depend on the field (=1 if Data.CoordUnit=1 in plot_field)
    25822576    end
    25832577    if ~isempty(errormsg)
     
    26512645
    26522646%% update the mask
    2653 if isequal(get(handles.mask_test,'Value'),1)%if the mask option is on
     2647if isequal(get(handles.CheckMask,'Value'),1)%if the mask option is on
    26542648   update_mask(handles,num_i1,num_i2);
    26552649end
     
    38183812     UvData.Object=UvData.Object(1);
    38193813end
    3820 list_object=get(handles.ListObject,'String');
     3814%list_object=get(handles.ListObject,'String');
    38213815set(handles.ListObject,'Value',1)
    38223816set(handles.ListObject,'String',{''})
     
    38263820
    38273821%delete mask if it is displayed
    3828 if isequal(get(handles.mask_test,'Value'),1)%if the mask option is on
     3822if isequal(get(handles.CheckMask,'Value'),1)%if the mask option is on
    38293823   UvData=rmfield(UvData,'MaskName'); %will impose mask refresh 
    38303824end
     
    38323826run0_Callback(hObject, eventdata, handles)
    38333827
    3834 %--------------------------------------------
     3828%------------------------------------------------------------------------
    38353829function histo1_menu_Callback(hObject, eventdata, handles)
    38363830%--------------------------------------------
     
    38423836update_histo(handles.histo_u,huvmat,FieldName)
    38433837
    3844 %----------------------------------------------
     3838%------------------------------------------------------------------------
    38453839function histo2_menu_Callback(hObject, eventdata, handles)
    3846 %----------------------------------------------
     3840%------------------------------------------------------------------------
    38473841%plot second histo
    38483842huvmat=get(handles.histo2_menu,'parent');
     
    38523846update_histo(handles.histo_v,huvmat,FieldName)
    38533847
    3854 
    3855 %--------------------------------------------
     3848%------------------------------------------------------------------------
    38563849%read the field .Fieldname stored in UvData and plot its histogram
    38573850function update_histo(haxes,huvmat,FieldName)
     3851%------------------------------------------------------------------------
    38583852UvData=get(huvmat,'UserData');
    38593853if ~isfield(UvData.Field,FieldName)
     
    41084102list=get(handles.ListColorCode,'String');
    41094103ichoice=get(handles.ListColorCode,'Value');
    4110 colcode.ColorCode=list{ichoice};
    4111 colcode.MinC=str2num(get(handles.num_MinVec,'String'));
    4112 colcode.MaxC=str2num(get(handles.num_MaxVec,'String'));
    4113 test3color=strcmp(colcode.ColorCode,'rgb') || strcmp(colcode.ColorCode,'bgr');
     4104colcode.ListColorCode=list{ichoice};
     4105colcode.MinVec=str2num(get(handles.num_MinVec,'String'));
     4106colcode.MaxVec=str2num(get(handles.num_MaxVec,'String'));
     4107test3color=strcmp(colcode.ListColorCode,'rgb') || strcmp(colcode.ListColorCode,'bgr');
    41144108if test3color
    4115     colcode.colcode1=str2num(get(handles.num_ColCode1,'String'));
    4116     colcode.colcode2=str2num(get(handles.num_ColCode2,'String'));
    4117 end
    4118 colcode.FixedCbounds=0;
    4119 colcode.FixedCbounds=1;
    4120 vec_C=colcode.MinC+(colcode.MaxC-colcode.MinC)*(0.5:width-0.5)/width;%sample of vec_C values from min to max
     4109    colcode.ColCode1=str2num(get(handles.num_ColCode1,'String'));
     4110    colcode.ColCode2=str2num(get(handles.num_ColCode2,'String'));
     4111end
     4112% colcode.FixedCbounds=0;
     4113%colcode.CheckFixVecColor=1;
     4114vec_C=colcode.MinVec+(colcode.MaxVec-colcode.MinVec)*(0.5:width-0.5)/width;%sample of vec_C values from min to max
    41214115[colorlist,col_vec]=set_col_vec(colcode,vec_C);
    41224116oneheight=ones(1,height);
     
    41384132write_plot_param(handles,PlotParamOut); %update the auto plot parameters
    41394133
    4140 %-------------------------------------------------------------------
    4141 % --- Executes on button press in grid.
    4142 function grid_Callback(hObject, eventdata, handles)
     4134% %-------------------------------------------------------------------
     4135% % --- Executes on button press in grid.
     4136% function grid_Callback(hObject, eventdata, handles)
    41434137
    41444138
Note: See TracChangeset for help on using the changeset viewer.