Changeset 60 for trunk/src/uvmat.m


Ignore:
Timestamp:
Mar 23, 2010, 2:52:49 PM (11 years ago)
Author:
sommeria
Message:

-plot projections on a new specific GUI view_field, to avoid the multiplication of active figures
-introduce a ruler in uvmat (in menu/Tools), to measure distances and angles
-insert automatic detection of points for geometric calibration: tool 'detect_grid'. Four points, deliminating the grid to determine, must be marked with the mouse, as well as the physical grid. Then the points inside are automatically detected.
-reading plane positions in ImaDoc? improved to deal with volume scans

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/uvmat.m

    r59 r60  
    229229addpath(fullfile(path_uvmat,'transform_field'))
    230230fct_handle{1,1}=[];
    231 testexist=zeros(size(menu_str));%default
     231testexist=zeros(size(menu_str'));%default
    232232testexist(1)=1;
    233233for ilist=2:length(menu_str)
     
    240240end
    241241rmpath(fullfile(path_uvmat,'transform_field'))
     242
     243%refresh projection plane
     244UvData.Object{1}.Style='plane';%main plotting plane
     245UvData.Object{1}.ProjMode='projection';%main plotting plane
     246if ~isfield(UvData.Object{1},'plotaxes')
     247    UvData.Object{1}.plotaxes=handles.axes3;%default plotting axis
     248    set(handles.list_object,'String',{'1-PLANE'});
     249    set(handles.list_object,'Value',1);
     250end
    242251
    243252%load the list of previously browsed files in menus Open and Open_1
     
    795804               set(handles.slices,'Value',1)
    796805           end
    797            set(handles.nb_slice,'String',num2str(NbSlice))
     806           if isequal(GeometryCalib.NbSlice,'volume')
     807               set(handles.nb_slice,'String','volume')
     808           else
     809               set(handles.nb_slice,'String',num2str(NbSlice))
     810           end
    798811           slices_Callback(hObject, eventdata, handles)
    799812    %        Coord=UvData.XmlData.GeometryCalib.SliceCoord;
    800813    %        ZIndex=num_i1-NbSlice*(floor((num_i1-1)/NbSlice));
    801814        end
     815
     816           
    802817    end
    803818end
    804819
    805820%update the data attached to the uvmat interface
    806 set(handles.nb_slice,'String',num2str(NbSlice))
     821% set(handles.nb_slice,'String',num2str(NbSlice))
    807822if ~isempty(TimeUnit)
    808823    set(handles.time_txt,'String',['time (' TimeUnit ')'])
     
    13481363    set(handles.z_index,'Visible','on')
    13491364    nb_slice_Callback(hObject, eventdata, handles)
    1350 %      z=mod(num_i1-1,nbslice)+1;
    1351 %         set(handles.z_index,'String',num2str(z))
    13521365else
    13531366    set(handles.nb_slice,'Visible','off')
     
    13621375function nb_slice_Callback(hObject, eventdata, handles)
    13631376%-------------------------------------------------------------------
    1364 num_i1=str2num(get(handles.i1,'String'));
    1365 nbslice=str2num(get(handles.nb_slice,'String'));
    1366 z=mod(num_i1-1,nbslice)+1;
     1377nb_slice_str=get(handles.nb_slice,'String')
     1378if isequal(nb_slice_str,'volume')
     1379    num=stra2num(get(handles.j1,'String'));
     1380    last_j=get(handles.last_j,'String');
     1381    nbslice=str2double(last_j{1});
     1382else
     1383    num=str2double(get(handles.i1,'String'));
     1384    nbslice=str2double(get(handles.nb_slice,'String'));
     1385end
     1386z=mod(num-1,nbslice)+1;
    13671387set(handles.z_index,'String',num2str(z))
    13681388for ilist=1:nbslice
     
    17981818            Field.A=imread(imaname_1);
    17991819end
     1820if get(handles.slices,'Value')
     1821    Field.ZIndex=str2double(get(handles.z_index,'String'));
     1822end
    18001823
    18011824%px to phys or other transform on field
     
    18851908    NomType=get(handles.FileIndex,'UserData');
    18861909    %update the z position index
    1887     nbslice=str2double(get(handles.nb_slice,'String'));
    1888     if ~isnan(nbslice)
     1910    nbslice_str=get(handles.nb_slice,'String');
     1911    z_index=1;%default
     1912    if isequal(nbslice_str,'volume')
     1913        z_index=num_j1;
     1914        set(handles.z_index,'String',num2str(z_index))
     1915    else
     1916        nbslice=str2num(nbslice_str);
    18891917        z_index=mod(num_i1-1,nbslice)+1;
    18901918        set(handles.z_index,'String',num2str(z_index))
    1891         % refresh menu for save_mask if relevant
    1892         masknumber=get(handles.masklevel,'String');
    1893         if length(masknumber)>=z_index
    1894             set(handles.masklevel,'Value',z_index)
    1895         end
    1896     end
     1919    end
     1920    % refresh menu for save_mask if relevant
     1921    masknumber=get(handles.masklevel,'String');
     1922    if length(masknumber)>=z_index
     1923        set(handles.masklevel,'Value',z_index)
     1924    end
     1925
    18971926    % determine the input file type
    18981927    if isequal(Ext,'.nc')||isequal(Ext,'.cdf')
     
    22202249       if siz(1)>1
    22212250           NbSlice=siz(1);
    2222            set(handles.slices,'Visible','on')
    2223            set(handles.slices,'Value',1)
     2251%            set(handles.slices,'Visible','on')
     2252%            set(handles.slices,'Value',1)
    22242253       else
    22252254           NbSlice=1;
    22262255       end
    2227        set(handles.nb_slice,'String',num2str(NbSlice))
    2228        slices_Callback(handles.uvmat, [], handles)
     2256       %set(handles.nb_slice,'String',num2str(NbSlice))
     2257%        slices_Callback(handles.uvmat, [], handles)
    22292258end
    22302259
     
    22562285% z index
    22572286if ~isempty(filename)
    2258     Field{1}.ZIndex=mod(num_i1-1,nbslice)+1;
     2287    Field{1}.ZIndex=z_index;
    22592288end
    22602289
     
    22622291if ~isempty(transform)
    22632292    if length(Field)>=2
    2264         Field{2}.ZIndex=mod(num_i1-1,nbslice)+1;
     2293        Field{2}.ZIndex=z_index;
    22652294        [Field{1},Field{2}]=transform(Field{1},XmlData,Field{2},XmlData_1);
    22662295        if isempty(Field{2})
     
    24262455if ~isfield(UvData.Object{1},'plotaxes')
    24272456    UvData.Object{1}.plotaxes=handles.axes3;%default plotting axis
    2428     set(handles.list_object,'String',{'1-PLANE';'...'});
     2457    set(handles.list_object,'String',{'1-PLANE'});
    24292458    set(handles.list_object,'Value',1);
    24302459end
     
    24702499    set(handles.MaxA,'String','255')
    24712500end
    2472 
     2501IndexObj=get(handles.list_object,'Value');
    24732502Object=UvData.Object;
    2474 for iobj=1:length(Object)
     2503IndexObj=min(IndexObj,numel(Object));
     2504for iobj=[1 IndexObj]
    24752505    if ~isempty(Object{iobj})%& isfield(Object{iobj},'plotaxes')& ishandle(Object{iobj}.plotaxes)
    24762506        %Projeter les champs sur l'objet:*
     
    27022732%-------------------------------------------------------------------
    27032733function zoom_Callback(hObject, eventdata, handles)
    2704 %huvmat=get(handles.zoom,'parent');%general input
    2705 UvData=get(handles.uvmat,'UserData');
     2734
    27062735if (get(handles.zoom,'Value') == 1);
    27072736    set(handles.zoom,'BackgroundColor',[1 1 0])
    27082737    set(handles.FixedLimits,'Value',1)% propose by default fixed limits for the plotting axes
    2709     set(handles.FixedLimits,'BackgroundColor',[1 1 0])
    2710     %UvData.ZoomOn=1;   %test for mouse action   
     2738    set(handles.FixedLimits,'BackgroundColor',[1 1 0])
    27112739else
    27122740    set(handles.zoom,'BackgroundColor',[0.7 0.7 0.7])
    2713     %UvData.ZoomOn=0;  %test for mouse action
    2714 end
    2715 set(handles.uvmat,'UserData',UvData);
     2741end
     2742
    27162743
    27172744%-------------------------------------------------------------------
     
    33693396end
    33703397
    3371 %------------------------------------------------
    3372 function create_Callback(hObject,eventdata,handles)
    3373 %------------------------------------------------
    3374 if ishandle(handles.UVMAT_title)
    3375     delete(handles.UVMAT_title)
    3376 end
    3377 huvmat=get(handles.create,'parent');
    3378 UvData=get(huvmat,'UserData');%read UvData properties stored on the uvmat interface (handles huvmat)
    3379 if isequal(get(handles.create,'Value'),1)
    3380     set(handles.zoom,'Value',0)
    3381     zoom_Callback(hObject, eventdata, handles)
    3382      set(handles.create,'BackgroundColor',[1 1 0]) %visualise in yellow
    3383     set(handles.edit_vect,'Value',0) 
    3384     edit_vect_Callback(hObject, eventdata, handles)
    3385     set(handles.edit,'Value',0)
    3386     set(handles.edit,'BackgroundColor',[0.7 0.7 0.7])
    3387     list_object=get(handles.list_object,'String');
    3388     if ~isempty(list_object)
    3389         set(handles.list_object,'Value',length(list_object))
    3390     end
    3391     MouseAction='create_object';
    3392     hset_object=findobj(allchild(0),'Name','set_object');
    3393     uistack(hset_object,'top')
    3394 else
    3395     set(handles.create,'BackgroundColor',[0 1 0])
    3396     set(handles.edit,'Value',1)
    3397     set(handles.edit,'BackgroundColor',[1 1 0])
    3398     MouseAction='none';
    3399 end
    3400 
    3401 UvData.MouseAction=MouseAction;
    3402 set(huvmat,'UserData',UvData);
    3403 
    3404 %------------------------------------------------
    3405 function POINTS_Callback(hObject,eventdata,handles)
    3406 %------------------------------------------------
    3407 if ishandle(handles.UVMAT_title)
    3408     delete(handles.UVMAT_title)
    3409 end
    3410 huvmat=get(handles.create,'parent');
    3411 UvData=get(huvmat,'UserData');%read UvData properties stored on the uvmat interface (handles huvmat)
    3412 if isequal(get(handles.create,'Value'),1)
    3413     set(handles.zoom,'Value',0)
    3414     zoom_Callback(hObject, eventdata, handles)
    3415     set(handles.edit_vect,'Value',0) 
    3416     edit_vect_Callback(hObject, eventdata, handles)
    3417     set(handles.edit,'Value',0)
    3418     set(handles.edit,'BackgroundColor',[0.7 0.7 0.7])
    3419     %set(handles.grid,'Value',0)
    3420     %set(handles.grid,'BackgroundColor',[0 1 0])
    3421     % initiate set_object GUI
    3422      data.TITLE='POINTS';
    3423     if isfield(UvData,'CoordType')
    3424         data.CoordType=UvData.CoordType;
    3425     end
    3426     if isfield(UvData,'Mesh')&~isempty(UvData.Mesh)
    3427         data.RangeY=UvData.Mesh;
    3428     elseif isfield(UvData,'AX')&isfield(UvData,'AY')& isfield(UvData,'A')%only image
    3429         np=size(UvData.Field.A);
    3430         meshx=(UvData.Field.AX(end)-UvData.Field.AX(1))/np(2);
    3431         meshy=abs(UvData.Field.AY(end)-UvData.Field.AY(1))/np(1);
    3432         data.RangeY=max(meshx,meshy);
    3433         data.DX=max(meshx,meshy);
    3434     end
    3435     data.Coord=[0 0 0]; %default
    3436     data.ParentButton=handles.create;
    3437     PlotHandles=get_plot_handles(handles);%get the handles of the graphic objects setting the plotting parameters
    3438     [hset_object,UvData.sethandles]=set_object(data,PlotHandles);% call the set_object interface
    3439     if isfield(UvData,'SetObjectOrigin')
    3440     pos_uvmat=get(huvmat,'Position');
    3441     pos_set_object(1:2)=UvData.SetObjectOrigin + pos_uvmat(1:2);
    3442     pos_set_object(3:4)=UvData.SetObjectSize .* pos_uvmat(3:4);
    3443     set(hset_object,'Position',pos_set_object)
    3444     end
    3445     %set(hset_object,'Position',[pos_uvmat(1) pos_uvmat(2)-0.05*pos_uvmat(4) 0.2*pos_uvmat(3)  0.5*pos_uvmat(4)]);
    3446     list_object=get(handles.list_object,'String');
    3447     if ~isempty(list_object)
    3448         set(handles.list_object,'Value',length(list_object))
    3449     end
    3450     MouseAction='create_object';
    3451     %UvData.ZoomOn=0;
    3452 else
    3453     set(handles.create,'BackgroundColor',[0 1 0])
    3454     set(handles.edit,'Value',1)
    3455     set(handles.edit,'BackgroundColor',[1 1 0])
    3456     MouseAction='none';
    3457 end
    3458 
    3459 UvData.MouseAction=MouseAction;
    3460 set(huvmat,'UserData',UvData);
    3461 
    3462 %-----------------------------------------------------------
    3463 function LINE_Callback(hObject, eventdata, handles)
    3464 %-------------------------------------------------
    3465 if ishandle(handles.UVMAT_title)
    3466     delete(handles.UVMAT_title)
    3467 end
    3468 % handles.uvmat
    3469 huvmat=get(handles.create,'parent');
    3470 UvData=get(huvmat,'UserData');%read UvData properties stored on the uvmat interface
    3471 set(handles.zoom,'Value',0)
    3472 zoom_Callback(hObject, eventdata, handles)
    3473 set(handles.edit_vect,'BackgroundColor',[0.7 0.7 0.7])
    3474 set(handles.edit_vect,'Value',0)
    3475 edit_vect_Callback(hObject, eventdata, handles)
    3476 set(handles.edit,'BackgroundColor',[0.7 0.7 0.7])
    3477 set(handles.edit,'Value',0)
    3478 set(handles.list_object,'Value',1);
    3479 edit_vect_Callback(hObject, eventdata, handles)
    3480 set(handles.edit,'BackgroundColor',[0.7 0.7 0.7])
    3481 set(handles.cal,'Value',0)
    3482 set(handles.cal,'BackgroundColor',[0 1 0])
    3483 %  initiate the set_object GUI
    3484 data.TITLE='LINE';
    3485 if isfield(UvData,'CoordType')
    3486     data.CoordType=UvData.CoordType;
    3487 end
    3488 if isfield(UvData,'Mesh')&~isempty(UvData.Mesh)
    3489     data.RangeX=UvData.Mesh;
    3490     data.RangeY=UvData.Mesh;
    3491     data.DX=UvData.Mesh;
    3492     data.DY=UvData.Mesh;
    3493 elseif isfield(UvData.Field,'AX')&isfield(UvData.Field,'AY')& isfield(UvData.Field,'A')%only image
    3494     np=size(UvData.Field.A);
    3495     meshx=(UvData.Field.AX(end)-UvData.Field.AX(1))/np(2);
    3496     meshy=abs(UvData.Field.AY(end)-UvData.Field.AY(1))/np(1);
    3497     data.RangeY=max(meshx,meshy);
    3498     data.RangeX=max(meshx,meshy);
    3499     data.DX=max(meshx,meshy);
    3500 end
    3501 if isfield(data,'DX')
    3502     data.Coord=[[0 0 0];[data.DX 0 0]]; %default
    3503 else
    3504     data.Coord=[[0 0 0];[1 0 0]]; %default
    3505 end
    3506 data.ParentButton=handles.create;
    3507 PlotHandles=get_plot_handles(handles);%get the handles of the interface elements setting the plotting parameters
    3508 [hset_object,UvData.sethandles]=set_object(data,PlotHandles);% call the set_object interface with action on haxes,
    3509                                                   % associate the set_edit interface handle to the plotting axes
    3510 pos_uvmat=get(huvmat,'Position');
    3511 if isfield(UvData,'SetObjectOrigin')
    3512     pos_set_object(1:2)=UvData.SetObjectOrigin + pos_uvmat(1:2);
    3513     pos_set_object(3:4)=UvData.SetObjectSize .* pos_uvmat(3:4); 
    3514     set(hset_object,'Position',pos_set_object)
    3515 end
    3516 list_object=get(handles.list_object,'String');
    3517 if ~isempty(list_object)
    3518     set(handles.list_object,'Value',length(list_object))
    3519 end
    3520 MouseAction='create_object';
    3521 UvData.MouseAction=MouseAction;
    3522 set(huvmat,'UserData',UvData)
    3523 
    3524 %-----------------------------------------------------------
    3525 function PATCH_Callback(hObject, eventdata, handles)
    3526 %-----------------------------------------------------------
    3527 if ishandle(handles.UVMAT_title)
    3528     delete(handles.UVMAT_title)
    3529 end
    3530 huvmat=get(handles.create,'parent');
    3531 UvData=get(huvmat,'UserData');%read UvData properties stored on the uvmat interface
    3532 % if isequal(get(handles.PATCH,'Value'),1)
    3533     set(handles.zoom,'Value',0)
    3534     set(handles.zoom,'BackgroundColor',[0.7 0.7 0.7])
    3535 %     set(handles.create,'Value',0)%suppress the other options if LINE is chosen
     3398% %------------------------------------------------
     3399% function create_Callback(hObject,eventdata,handles)
     3400% %------------------------------------------------
     3401% if ishandle(handles.UVMAT_title)
     3402%     delete(handles.UVMAT_title)
     3403% end
     3404% huvmat=get(handles.create,'parent');
     3405% UvData=get(huvmat,'UserData');%read UvData properties stored on the uvmat interface (handles huvmat)
     3406% if isequal(get(handles.create,'Value'),1)
     3407%     set(handles.zoom,'Value',0)
     3408%     zoom_Callback(hObject, eventdata, handles)
     3409%      set(handles.create,'BackgroundColor',[1 1 0]) %visualise in yellow
     3410%     set(handles.edit_vect,'Value',0) 
     3411%     edit_vect_Callback(hObject, eventdata, handles)
     3412%     set(handles.edit,'Value',0)
     3413%     set(handles.edit,'BackgroundColor',[0.7 0.7 0.7])
     3414%     list_object=get(handles.list_object,'String');
     3415%     if ~isempty(list_object)
     3416%         set(handles.list_object,'Value',length(list_object))
     3417%     end
     3418%     MouseAction='create_object';
     3419%     hset_object=findobj(allchild(0),'Name','set_object');
     3420%     uistack(hset_object,'top')
     3421% else
    35363422%     set(handles.create,'BackgroundColor',[0 1 0])
    3537 %     set(handles.LINE,'Value',0)
    3538 %     set(handles.LINE,'BackgroundColor',[0 1 0])
    3539 %     set(handles.PATCH,'Value',1)
    3540 %     set(handles.PATCH,'BackgroundColor',[1 1 0])
    3541 %     set(handles.PLANE,'Value',0)
    3542 %     set(handles.PLANE,'BackgroundColor',[0 1 0])%put activated buttons to yellow
    3543 %     set(handles.VOLUME,'Value',0)
    3544 %     set(handles.VOLUME,'BackgroundColor',[0 1 0])
    3545     %set(handles.makemask,'Value',0)
    3546     %makemask_Callback(hObject, eventdata, handles)
    3547     set(handles.edit_vect,'Value',0)
    3548     edit_vect_Callback(hObject, eventdata, handles)
    3549     set(handles.edit,'Value',0)
    3550     set(handles.edit,'BackgroundColor',[0.7 0.7 0.7])
    3551     set(handles.edit_vect,'Value',0) 
    3552     edit_vect_Callback(hObject, eventdata, handles)
    3553     set(handles.cal,'Value',0)
    3554     set(handles.cal,'BackgroundColor',[0 1 0])
    3555     %set(handles.grid,'Value',0)
    3556     %set(handles.grid,'BackgroundColor',[0 1 0])
    3557     %initiate set_object GUI
    3558     data.TITLE='PATCH';
    3559     if isfield(UvData,'CoordType')
    3560         data.CoordType=UvData.CoordType;
    3561     end
    3562     if isfield(UvData,'Mesh')&~isempty(UvData.Mesh)
    3563         data.YMax=UvData.Mesh;
    3564     elseif isfield(UvData.Field,'AX')&isfield(UvData.Field,'AY')& isfield(UvData.Field,'A')%only image
    3565         np=size(UvData.Field.A);
    3566         meshx=(UvData.Field.AX(end)-UvData.Field.AX(1))/(np(2)-1);
    3567         meshy=abs(UvData.Field.AY(end)-UvData.Field.AY(1))/(np(1)-1);
    3568         data.YMax=max(meshx,meshy);
    3569         data.DX=max(meshx,meshy);
    3570     end
    3571     data.Coord=[0 0 0]; %default
    3572     data.ParentButton=handles.create;
    3573     PlotHandles=get_plot_handles(handles);%get the handles of the graphic objects setting the plotting parameters
    3574     [hset_object,UvData.sethandles]=set_object(data,PlotHandles);% call the set_object interface
    3575     pos_uvmat=get(huvmat,'Position');
    3576     if isfield(UvData,'SetObjectOrigin')
    3577         pos_set_object(1:2)=UvData.SetObjectOrigin + pos_uvmat(1:2);
    3578         pos_set_object(3:4)=UvData.SetObjectSize .* pos_uvmat(3:4);
    3579         set(hset_object,'Position',pos_set_object)
    3580     end
    3581     list_object=get(handles.list_object,'String');
    3582     if ~isempty(list_object)
    3583         set(handles.list_object,'Value',length(list_object))
    3584     end
    3585     UvData.MouseAction='create_object';
    3586     set(huvmat,'UserData',UvData);
    3587 %-------------------------------------------------------
    3588 function PLANE_Callback(hObject, eventdata, handles)
    3589 %-------------------------------------------------------
    3590 if ishandle(handles.UVMAT_title)
    3591     delete(handles.UVMAT_title)
    3592 end
    3593 huvmat=get(handles.create,'parent');
    3594 UvData=get(huvmat,'UserData');%read UvData properties stored on the uvmat interface
    3595 set(handles.zoom,'Value',0)
    3596 set(handles.zoom,'BackgroundColor',[0.7 0.7 0.7])
    3597 set(handles.edit_vect,'Value',0)
    3598 edit_vect_Callback(hObject, eventdata, handles)
    3599 set(handles.edit,'Value',0)
    3600 set(handles.edit,'BackgroundColor',[0.7 0.7 0.7])
    3601 set(handles.cal,'Value',0)
    3602 set(handles.cal,'BackgroundColor',[0 1 0])
    3603 %set(handles.grid,'Value',0)
    3604 %set(handles.grid,'BackgroundColor',[0 1 0])
    3605 %initiate set_object GUI
    3606 data.TITLE='PLANE';
    3607 if isfield(UvData,'CoordType')
    3608     data.CoordType=UvData.CoordType;
    3609 end
    3610 %Si 3D data.nbdim=3;
    3611 %Si 2D
    3612 if isfield(UvData,'Mesh')&~isempty(UvData.Mesh)
    3613     data.ZMax=UvData.Mesh;
    3614     data.DX=UvData.Mesh;
    3615     data.DY=UvData.Mesh;
    3616 elseif isfield(UvData.Field,'AX')&isfield(UvData.Field,'AY')& isfield(UvData.Field,'A')%only image
    3617     np=size(UvData.Field.A);
    3618     meshx=(UvData.Field.AX(end)-UvData.Field.AX(1))/(np(2)-1);
    3619     meshy=abs(UvData.Field.AY(end)-UvData.Field.AY(1))/(np(1)-1);
    3620     data.DX=max(meshx,meshy);
    3621 end
    3622 if isfield(UvData,'DX')
    3623     data.DX=UvData.DX;
    3624 end
    3625 if isfield(UvData,'DY')
    3626     data.DY=UvData.DY;
    3627 elseif isfield(UvData,'Mesh')
    3628     data.DY=UvData.Mesh;
    3629 end
    3630 if isfield(UvData.Field,'X')& isfield(UvData.Field,'Y')
    3631     data.Coord=[0 0 0];
    3632     data.Style='plane';
    3633     data.Phi=0;
    3634     data.IndexObj=1; %act on the first reference plane by default
    3635     haxes= handles.axes3;%GENERALISER
    3636     plot_object(data,[],haxes,'m'); %plot the axes of the default plane 
    3637 end
    3638 data.ParentButton=handles.create;
    3639 PlotHandles=get_plot_handles(handles);%get the handles of the graphic objects setting the plotting parameters
    3640 ZBounds=0; % default
    3641 if isfield(UvData,'ZMin') && isfield(UvData,'ZMax')
    3642     ZBounds(1)=UvData.ZMin; %minimum for the Z slider
    3643     ZBounds(2)=UvData.ZMax;%maximum for the Z slider
    3644 end
    3645 [hset_object,UvData.sethandles]=set_object(data,PlotHandles,ZBounds);% call the set_object interface with action on haxes,
    3646 if isfield(UvData,'SetObjectOrigin')
    3647 pos_uvmat=get(huvmat,'Position');
    3648 pos_set_object(1:2)=UvData.SetObjectOrigin + pos_uvmat(1:2);
    3649 pos_set_object(3:4)=UvData.SetObjectSize .* pos_uvmat(3:4); 
    3650 set(hset_object,'Position',pos_set_object)
    3651 end
    3652 list_object=get(handles.list_object,'String');
    3653 nbobject=length(list_object);
    3654 set(handles.list_object,'Value',nbobject)
    3655 UvData.MouseAction='create_object';
    3656 set(huvmat,'UserData',UvData)
     3423%     set(handles.edit,'Value',1)
     3424%     set(handles.edit,'BackgroundColor',[1 1 0])
     3425%     MouseAction='none';
     3426% end
     3427%
     3428% UvData.MouseAction=MouseAction;
     3429% set(huvmat,'UserData',UvData);
     3430%
     3431% %------------------------------------------------
     3432% function POINTS_Callback(hObject,eventdata,handles)
     3433% %------------------------------------------------
     3434% if ishandle(handles.UVMAT_title)
     3435%     delete(handles.UVMAT_title)
     3436% end
     3437% huvmat=get(handles.create,'parent');
     3438% UvData=get(huvmat,'UserData');%read UvData properties stored on the uvmat interface (handles huvmat)
     3439% if isequal(get(handles.create,'Value'),1)
     3440%     set(handles.zoom,'Value',0)
     3441%     zoom_Callback(hObject, eventdata, handles)
     3442%     set(handles.edit_vect,'Value',0) 
     3443%     edit_vect_Callback(hObject, eventdata, handles)
     3444%     set(handles.edit,'Value',0)
     3445%     set(handles.edit,'BackgroundColor',[0.7 0.7 0.7])
     3446%     %set(handles.grid,'Value',0)
     3447%     %set(handles.grid,'BackgroundColor',[0 1 0])
     3448%     % initiate set_object GUI
     3449%      data.TITLE='POINTS';
     3450%     if isfield(UvData,'CoordType')
     3451%         data.CoordType=UvData.CoordType;
     3452%     end
     3453%     if isfield(UvData,'Mesh')&~isempty(UvData.Mesh)
     3454%         data.RangeY=UvData.Mesh;
     3455%     elseif isfield(UvData,'AX')&isfield(UvData,'AY')& isfield(UvData,'A')%only image
     3456%         np=size(UvData.Field.A);
     3457%         meshx=(UvData.Field.AX(end)-UvData.Field.AX(1))/np(2);
     3458%         meshy=abs(UvData.Field.AY(end)-UvData.Field.AY(1))/np(1);
     3459%         data.RangeY=max(meshx,meshy);
     3460%         data.DX=max(meshx,meshy);
     3461%     end
     3462%     data.Coord=[0 0 0]; %default
     3463%     data.ParentButton=handles.create;
     3464%     PlotHandles=get_plot_handles(handles);%get the handles of the graphic objects setting the plotting parameters
     3465%     [hset_object,UvData.sethandles]=set_object(data,PlotHandles);% call the set_object interface
     3466%     if isfield(UvData,'SetObjectOrigin')
     3467%     pos_uvmat=get(huvmat,'Position');
     3468%     pos_set_object(1:2)=UvData.SetObjectOrigin + pos_uvmat(1:2);
     3469%     pos_set_object(3:4)=UvData.SetObjectSize .* pos_uvmat(3:4);
     3470%     set(hset_object,'Position',pos_set_object)
     3471%     end
     3472%     %set(hset_object,'Position',[pos_uvmat(1) pos_uvmat(2)-0.05*pos_uvmat(4) 0.2*pos_uvmat(3)  0.5*pos_uvmat(4)]);
     3473%     list_object=get(handles.list_object,'String');
     3474%     if ~isempty(list_object)
     3475%         set(handles.list_object,'Value',length(list_object))
     3476%     end
     3477%     MouseAction='create_object';
     3478%     %UvData.ZoomOn=0;
     3479% else
     3480%     set(handles.create,'BackgroundColor',[0 1 0])
     3481%     set(handles.edit,'Value',1)
     3482%     set(handles.edit,'BackgroundColor',[1 1 0])
     3483%     MouseAction='none';
     3484% end
     3485%
     3486% UvData.MouseAction=MouseAction;
     3487% set(huvmat,'UserData',UvData);
     3488
     3489% %-----------------------------------------------------------
     3490% function LINE_Callback(hObject, eventdata, handles)
     3491% %-------------------------------------------------
     3492% if ishandle(handles.UVMAT_title)
     3493%     delete(handles.UVMAT_title)
     3494% end
     3495% % handles.uvmat
     3496% huvmat=get(handles.create,'parent');
     3497% UvData=get(huvmat,'UserData');%read UvData properties stored on the uvmat interface
     3498% set(handles.zoom,'Value',0)
     3499% zoom_Callback(hObject, eventdata, handles)
     3500% set(handles.edit_vect,'BackgroundColor',[0.7 0.7 0.7])
     3501% set(handles.edit_vect,'Value',0)
     3502% edit_vect_Callback(hObject, eventdata, handles)
     3503% set(handles.edit,'BackgroundColor',[0.7 0.7 0.7])
     3504% set(handles.edit,'Value',0)
     3505% set(handles.list_object,'Value',1);
     3506% edit_vect_Callback(hObject, eventdata, handles)
     3507% set(handles.edit,'BackgroundColor',[0.7 0.7 0.7])
     3508% set(handles.cal,'Value',0)
     3509% set(handles.cal,'BackgroundColor',[0 1 0])
     3510% %  initiate the set_object GUI
     3511% data.TITLE='LINE';
     3512% if isfield(UvData,'CoordType')
     3513%     data.CoordType=UvData.CoordType;
     3514% end
     3515% if isfield(UvData,'Mesh')&~isempty(UvData.Mesh)
     3516%     data.RangeX=UvData.Mesh;
     3517%     data.RangeY=UvData.Mesh;
     3518%     data.DX=UvData.Mesh;
     3519%     data.DY=UvData.Mesh;
     3520% elseif isfield(UvData.Field,'AX')&isfield(UvData.Field,'AY')& isfield(UvData.Field,'A')%only image
     3521%     np=size(UvData.Field.A);
     3522%     meshx=(UvData.Field.AX(end)-UvData.Field.AX(1))/np(2);
     3523%     meshy=abs(UvData.Field.AY(end)-UvData.Field.AY(1))/np(1);
     3524%     data.RangeY=max(meshx,meshy);
     3525%     data.RangeX=max(meshx,meshy);
     3526%     data.DX=max(meshx,meshy);
     3527% end
     3528% if isfield(data,'DX')
     3529%     data.Coord=[[0 0 0];[data.DX 0 0]]; %default
     3530% else
     3531%     data.Coord=[[0 0 0];[1 0 0]]; %default
     3532% end
     3533% data.ParentButton=handles.create;
     3534% PlotHandles=get_plot_handles(handles);%get the handles of the interface elements setting the plotting parameters
     3535% [hset_object,UvData.sethandles]=set_object(data,PlotHandles);% call the set_object interface with action on haxes,
     3536%                                                   % associate the set_edit interface handle to the plotting axes
     3537% pos_uvmat=get(huvmat,'Position');
     3538% if isfield(UvData,'SetObjectOrigin')
     3539%     pos_set_object(1:2)=UvData.SetObjectOrigin + pos_uvmat(1:2);
     3540%     pos_set_object(3:4)=UvData.SetObjectSize .* pos_uvmat(3:4); 
     3541%     set(hset_object,'Position',pos_set_object)
     3542% end
     3543% list_object=get(handles.list_object,'String');
     3544% if ~isempty(list_object)
     3545%     set(handles.list_object,'Value',length(list_object))
     3546% end
     3547% MouseAction='create_object';
     3548% UvData.MouseAction=MouseAction;
     3549% set(huvmat,'UserData',UvData)
     3550
     3551% %-----------------------------------------------------------
     3552% function PATCH_Callback(hObject, eventdata, handles)
     3553% %-----------------------------------------------------------
     3554% if ishandle(handles.UVMAT_title)
     3555%     delete(handles.UVMAT_title)
     3556% end
     3557% huvmat=get(handles.create,'parent');
     3558% UvData=get(huvmat,'UserData');%read UvData properties stored on the uvmat interface
     3559% % if isequal(get(handles.PATCH,'Value'),1)
     3560%     set(handles.zoom,'Value',0)
     3561%     set(handles.zoom,'BackgroundColor',[0.7 0.7 0.7])
     3562% %     set(handles.create,'Value',0)%suppress the other options if LINE is chosen
     3563% %     set(handles.create,'BackgroundColor',[0 1 0])
     3564% %     set(handles.LINE,'Value',0)
     3565% %     set(handles.LINE,'BackgroundColor',[0 1 0])
     3566% %     set(handles.PATCH,'Value',1)
     3567% %     set(handles.PATCH,'BackgroundColor',[1 1 0])
     3568% %     set(handles.PLANE,'Value',0)
     3569% %     set(handles.PLANE,'BackgroundColor',[0 1 0])%put activated buttons to yellow
     3570% %     set(handles.VOLUME,'Value',0)
     3571% %     set(handles.VOLUME,'BackgroundColor',[0 1 0])
     3572%     %set(handles.makemask,'Value',0)
     3573%     %makemask_Callback(hObject, eventdata, handles)
     3574%     set(handles.edit_vect,'Value',0)
     3575%     edit_vect_Callback(hObject, eventdata, handles)
     3576%     set(handles.edit,'Value',0)
     3577%     set(handles.edit,'BackgroundColor',[0.7 0.7 0.7])
     3578%     set(handles.edit_vect,'Value',0) 
     3579%     edit_vect_Callback(hObject, eventdata, handles)
     3580%     set(handles.cal,'Value',0)
     3581%     set(handles.cal,'BackgroundColor',[0 1 0])
     3582%     %set(handles.grid,'Value',0)
     3583%     %set(handles.grid,'BackgroundColor',[0 1 0])
     3584%     %initiate set_object GUI
     3585%     data.TITLE='PATCH';
     3586%     if isfield(UvData,'CoordType')
     3587%         data.CoordType=UvData.CoordType;
     3588%     end
     3589%     if isfield(UvData,'Mesh')&~isempty(UvData.Mesh)
     3590%         data.YMax=UvData.Mesh;
     3591%     elseif isfield(UvData.Field,'AX')&isfield(UvData.Field,'AY')& isfield(UvData.Field,'A')%only image
     3592%         np=size(UvData.Field.A);
     3593%         meshx=(UvData.Field.AX(end)-UvData.Field.AX(1))/(np(2)-1);
     3594%         meshy=abs(UvData.Field.AY(end)-UvData.Field.AY(1))/(np(1)-1);
     3595%         data.YMax=max(meshx,meshy);
     3596%         data.DX=max(meshx,meshy);
     3597%     end
     3598%     data.Coord=[0 0 0]; %default
     3599%     data.ParentButton=handles.create;
     3600%     PlotHandles=get_plot_handles(handles);%get the handles of the graphic objects setting the plotting parameters
     3601%     [hset_object,UvData.sethandles]=set_object(data,PlotHandles);% call the set_object interface
     3602%     pos_uvmat=get(huvmat,'Position');
     3603%     if isfield(UvData,'SetObjectOrigin')
     3604%         pos_set_object(1:2)=UvData.SetObjectOrigin + pos_uvmat(1:2);
     3605%         pos_set_object(3:4)=UvData.SetObjectSize .* pos_uvmat(3:4);
     3606%         set(hset_object,'Position',pos_set_object)
     3607%     end
     3608%     list_object=get(handles.list_object,'String');
     3609%     if ~isempty(list_object)
     3610%         set(handles.list_object,'Value',length(list_object))
     3611%     end
     3612%     UvData.MouseAction='create_object';
     3613%     set(huvmat,'UserData',UvData);
     3614% %-------------------------------------------------------
     3615% function PLANE_Callback(hObject, eventdata, handles)
     3616% %-------------------------------------------------------
     3617% if ishandle(handles.UVMAT_title)
     3618%     delete(handles.UVMAT_title)
     3619% end
     3620% huvmat=get(handles.create,'parent');
     3621% UvData=get(huvmat,'UserData');%read UvData properties stored on the uvmat interface
     3622% set(handles.zoom,'Value',0)
     3623% set(handles.zoom,'BackgroundColor',[0.7 0.7 0.7])
     3624% set(handles.edit_vect,'Value',0)
     3625% edit_vect_Callback(hObject, eventdata, handles)
     3626% set(handles.edit,'Value',0)
     3627% set(handles.edit,'BackgroundColor',[0.7 0.7 0.7])
     3628% set(handles.cal,'Value',0)
     3629% set(handles.cal,'BackgroundColor',[0 1 0])
     3630% %set(handles.grid,'Value',0)
     3631% %set(handles.grid,'BackgroundColor',[0 1 0])
     3632% %initiate set_object GUI
     3633% data.TITLE='PLANE';
     3634% if isfield(UvData,'CoordType')
     3635%     data.CoordType=UvData.CoordType;
     3636% end
     3637% %Si 3D data.nbdim=3;
     3638% %Si 2D
     3639% if isfield(UvData,'Mesh')&~isempty(UvData.Mesh)
     3640%     data.ZMax=UvData.Mesh;
     3641%     data.DX=UvData.Mesh;
     3642%     data.DY=UvData.Mesh;
     3643% elseif isfield(UvData.Field,'AX')&isfield(UvData.Field,'AY')& isfield(UvData.Field,'A')%only image
     3644%     np=size(UvData.Field.A);
     3645%     meshx=(UvData.Field.AX(end)-UvData.Field.AX(1))/(np(2)-1);
     3646%     meshy=abs(UvData.Field.AY(end)-UvData.Field.AY(1))/(np(1)-1);
     3647%     data.DX=max(meshx,meshy);
     3648% end
     3649% if isfield(UvData,'DX')
     3650%     data.DX=UvData.DX;
     3651% end
     3652% if isfield(UvData,'DY')
     3653%     data.DY=UvData.DY;
     3654% elseif isfield(UvData,'Mesh')
     3655%     data.DY=UvData.Mesh;
     3656% end
     3657% if isfield(UvData.Field,'X')& isfield(UvData.Field,'Y')
     3658%     data.Coord=[0 0 0];
     3659%     data.Style='plane';
     3660%     data.Phi=0;
     3661%     data.IndexObj=1; %act on the first reference plane by default
     3662%     haxes= handles.axes3;%GENERALISER
     3663%     plot_object(data,[],haxes,'m'); %plot the axes of the default plane 
     3664% end
     3665% data.ParentButton=handles.create;
     3666% PlotHandles=get_plot_handles(handles);%get the handles of the graphic objects setting the plotting parameters
     3667% ZBounds=0; % default
     3668% if isfield(UvData,'ZMin') && isfield(UvData,'ZMax')
     3669%     ZBounds(1)=UvData.ZMin; %minimum for the Z slider
     3670%     ZBounds(2)=UvData.ZMax;%maximum for the Z slider
     3671% end
     3672% [hset_object,UvData.sethandles]=set_object(data,PlotHandles,ZBounds);% call the set_object interface with action on haxes,
     3673% if isfield(UvData,'SetObjectOrigin')
     3674% pos_uvmat=get(huvmat,'Position');
     3675% pos_set_object(1:2)=UvData.SetObjectOrigin + pos_uvmat(1:2);
     3676% pos_set_object(3:4)=UvData.SetObjectSize .* pos_uvmat(3:4); 
     3677% set(hset_object,'Position',pos_set_object)
     3678% end
     3679% list_object=get(handles.list_object,'String');
     3680% nbobject=length(list_object);
     3681% set(handles.list_object,'Value',nbobject)
     3682% UvData.MouseAction='create_object';
     3683% set(huvmat,'UserData',UvData)
    36573684
    36583685%-------------------------------------------------------
     
    45024529%--------------------------------------------------------
    45034530function list_object_Callback(hObject, eventdata, handles)
    4504 huvmat=get(handles.list_object,'parent');
    4505 UvData=get(huvmat,'UserData');%read UvData properties stored on the uvmat interface
     4531UvData=get(handles.uvmat,'UserData');%read UvData properties stored on the uvmat interface
    45064532list_str=get(handles.list_object,'String');
    45074533IndexObj=get(handles.list_object,'Value');
     
    45224548    end
    45234549AxeData.hset_object=set_object(ObjectData,PlotHandles,ZBounds);% call the set_object interface,
    4524 pos_uvmat=get(huvmat,'Position');
     4550pos_uvmat=get(handles.uvmat,'Position');
    45254551if isfield(UvData,'SetObjectOrigin')
    45264552pos_set_object(1:2)=UvData.SetObjectOrigin + pos_uvmat(1:2);
     
    45284554set(AxeData.hset_object,'Position',pos_set_object)
    45294555end
     4556
     4557%project the current field on the object and plot it
     4558ProjData= proj_field(UvData.Field,ObjectData,IndexObj);%project the current interface field on ObjectData
     4559if length(UvData.Object)>= IndexObj && isfield(UvData.Object{IndexObj},'plotaxes')&& ishandle(UvData.Object{IndexObj}.plotaxes)
     4560    plot_field(ProjData,UvData.Object{IndexObj}.plotaxes,PlotHandles);
     4561else
     4562     UvData.Object{IndexObj}.plotaxes=view_field(ProjData);
     4563     set(handles.uvmat,'UserData',UvData)
     4564end
     4565
    45304566hother=findobj('Tag','proj_object');%find all the proj objects
    45314567for iobj=1:length(hother)
     
    50495085zoom_Callback(handles.uvmat, [], handles)
    50505086
     5087
     5088
     5089% --------------------------------------------------------------------
     5090function MenuRuler_Callback(hObject, eventdata, handles)
     5091set(handles.zoom,'Value',0)
     5092zoom_Callback(handles.uvmat, [], handles)
     5093UvData=get(handles.uvmat,'UserData');
     5094UvData.MouseAction='ruler';
     5095set(handles.uvmat,'UserData',UvData);
     5096
     5097
Note: See TracChangeset for help on using the changeset viewer.