Changeset 227 for trunk/src/set_object.m


Ignore:
Timestamp:
Mar 31, 2011, 1:42:51 PM (13 years ago)
Author:
sommeria
Message:

add function sub_field_series to apply the sub_field operation to a series of fileds (for instance subtracting a background to an image series)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/set_object.m

    r215 r227  
    766766
    767767%% plot the field projected on the object and store in the corresponding figue
    768 ProjData= proj_field(UvData.Field,ObjectData);%project the current interface field on ObjectData
     768[ProjData,errormsg]= proj_field(UvData.Field,ObjectData);%project the current interface field on ObjectData
     769if ~isempty(errormsg)
     770    msgbox_uvmat('ERROR', errormsg)
     771    return
     772end
    769773PlotParam=read_plot_param(PlotHandles);
    770774[PlotType,Object_out{IndexObj}.PlotParam,plotaxes]=plot_field(ProjData,plotaxes,PlotParam);%update an existing field plot
     
    846850end
    847851msgbox_uvmat('CONFIRMATION',[answer{1}  ' saved'])
    848 %------------------------------------------------------------------------
     852
    849853%------------------------------------------------------------------------
    850854% --- Executes on slider movement.
     
    853857Z_value=get(handles.z_slider,'Value');
    854858%rotation angles
    855 PlaneAngle(1)=str2num(get(handles.Phi,'String'));%first  angle in degrees
    856 PlaneAngle(2)=str2num(get(handles.Theta,'String'));%second  angle in degrees
    857 PlaneAngle(3)=str2num(get(handles.Psi,'String'));%second  angle in degrees
     859PlaneAngle=[0 0 0];
     860norm_plane=[0 0 1];
     861cos_om=1;
     862sin_om=0;
     863
     864PlaneAngle(1)=str2double(get(handles.Phi,'String'));%first  angle in degrees
     865PlaneAngle(2)=str2double(get(handles.Theta,'String'));%second  angle in degrees
     866PlaneAngle(3)=str2double(get(handles.Psi,'String'));%second  angle in degrees
     867PlaneAngle=(pi/180)*PlaneAngle;
    858868om=norm(PlaneAngle);%norm of rotation angle in radians
    859 OmAxis=PlaneAngle/om; %unit vector marking the rotation axis
    860 cos_om=cos(pi*om/180);
    861 sin_om=sin(pi*om/180);
    862 coeff=OmAxis(3)*(1-cos_om);
    863 %components of the unity vector norm_plane normal to the projection plane
    864 norm_plane(1)=OmAxis(1)*coeff+OmAxis(2)*sin_om;
    865 norm_plane(2)=OmAxis(2)*coeff-OmAxis(1)*sin_om;
    866 norm_plane(3)=OmAxis(3)*coeff+cos_om;
     869if isequal(om,0)
     870    norm_plane=[0 0 1];
     871else
     872    OmAxis=PlaneAngle/om; %unit vector marking the rotation axis
     873    cos_om=cos(om);
     874    sin_om=sin(om);
     875    coeff=OmAxis(3)*(1-cos_om);
     876    %components of the unity vector norm_plane normal to the projection plane
     877    norm_plane(1)=OmAxis(1)*coeff+OmAxis(2)*sin_om;
     878    norm_plane(2)=OmAxis(2)*coeff-OmAxis(1)*sin_om;
     879    norm_plane(3)=OmAxis(3)*coeff+cos_om;
     880end
    867881
    868882%set new plane position and update graph
     
    871885set(handles.ZObject,'String',num2str(norm_plane(3)*Z_value,4))
    872886PLOT_Callback(hObject, eventdata, handles)
    873 %------------------------------------------------------------------------
     887
    874888%------------------------------------------------------------------------
    875889% --- Executes on button press in HELP.
    876890function HELP_Callback(hObject, eventdata, handles)
     891%------------------------------------------------------------------------
    877892path_to_uvmat=which ('uvmat');% check the path of uvmat
    878893pathelp=fileparts(path_to_uvmat);
Note: See TracChangeset for help on using the changeset viewer.