source: trunk/src/rotate_points.m @ 74

Last change on this file since 74 was 74, checked in by sommeria, 11 years ago

rotate_points: used for geometry_calib was forgotten. It is now added
plot_field now does not consider black the vectors with either vec_F=0 or vec_F=1 (vec_F=0 in the 3D3C software instead of vec_F=1)
set_object and uvmat: improvements for projection plane in volume vel data

File size: 5.6 KB
Line 
1%'rotate_points': associated with GUI rotate_points.fig to display message boxes, for error, warning or input calls
2% rotate_points(title,display)
3%
4% OUTPUT:
5% answer  (text string)= 'yes', 'No', 'cancel', or the text string introduced as input
6%
7%INPUT:
8% title: string indicating the type of message box:
9%          title= 'INPUT_TXT','CONFIMATION' ,'ERROR', 'WARNING', 'INPUT_Y-N', default = 'INPUT_TXT' (the title is displayed in the upper bar of the fig).
10%          if title='INPUT_TXT', input data is asked in an edit box
11%          if title='CONFIMATION'', 'ERROR', 'WARNING', the figure remains  opened until a button 'OK' is pressed
12%          if title='INPUT_Y-N', an answer Yes/No is requested
13% display, displayed text
14% default_answer: default answer in the edit box (only used with title='INPUT_TXT')
15
16function varargout = rotate_points(varargin)
17
18% Last Modified by GUIDE v2.5 05-Jan-2010 15:10:10
19
20% Begin initialization code - DO NOT EDIT
21gui_Singleton = 1;
22gui_State = struct('gui_Name',       mfilename, ...
23                   'gui_Singleton',  gui_Singleton, ...
24                   'gui_OpeningFcn', @rotate_points_OpeningFcn, ...
25                   'gui_OutputFcn',  @rotate_points_OutputFcn, ...
26                   'gui_LayoutFcn',  [] , ...
27                   'gui_Callback',   []);
28if nargin && ischar(varargin{1})
29    gui_State.gui_Callback = str2func(varargin{1});
30end
31
32if nargout
33    [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
34else
35    gui_mainfcn(gui_State, varargin{:});
36end
37% End initialization code - DO NOT EDIT
38
39% --- Executes just before rotate_points is made visible.
40function rotate_points_OpeningFcn(hObject, eventdata, handles,input_shift)
41% This function has no output args, see OutputFcn.
42
43% Choose default command line output for rotate_points
44handles.output = 'Cancel';
45
46% Update handles structure
47guidata(hObject, handles);
48testNo=0;
49testCancel=1;
50testinputstring=0;
51icontype='quest';%default question icon (text input asked)
52
53% Determine the position of the dialog - centered on the screen
54FigPos=get(0,'DefaultFigurePosition');
55OldUnits = get(hObject, 'Units');
56set(hObject, 'Units', 'pixels');
57OldPos = get(hObject,'Position');
58FigWidth = OldPos(3);
59FigHeight = OldPos(4);
60ScreenUnits=get(0,'Units');
61set(0,'Units','pixels');
62ScreenSize=get(0,'ScreenSize');
63set(0,'Units',ScreenUnits);
64
65FigPos(1)=1/2*(ScreenSize(3)-FigWidth);
66FigPos(2)=2/3*(ScreenSize(4)-FigHeight);
67FigPos(3:4)=[FigWidth FigHeight];
68set(hObject, 'Position', FigPos);
69set(hObject, 'Units', OldUnits);
70
71% Show a question icon from dialogicons.mat - variables questIconData and questIconMap
72load dialogicons.mat
73eval(['IconData=' icontype 'IconData;'])
74eval(['IconCMap=' icontype 'IconMap;'])
75questIconMap(256,:) = get(handles.figure1, 'Color');
76Img=image(IconData, 'Parent', handles.axes1);
77set(handles.figure1, 'Colormap', IconCMap);
78set(handles.axes1, ...
79    'Visible', 'off', ...
80    'YDir'   , 'reverse'       , ...
81    'XLim'   , get(Img,'XData'), ...
82    'YLim'   , get(Img,'YData')  ...
83    );
84
85if exist('input_shift','var') && ~isempty(input_shift)
86   set(handles.Phi,'String',num2str(input_shift(1)));
87   if numel(input_shift)>=2
88    set(handles.x_0,'String',num2str(input_shift(2)));
89   end
90   if numel(input_shift)>=3
91    set(handles.y_0,'String',num2str(input_shift(3)));
92   end
93end
94
95set(handles.figure1,'WindowStyle','modal')% Make% Make the GUI modal
96% UIWAIT makes rotate_points wait for user response (see UIRESUME)
97uiwait(handles.figure1);
98
99
100% --- Outputs from this function are returned to the command line.
101function varargout = rotate_points_OutputFcn(hObject, eventdata, handles)
102
103% Get default command line output from handles structure
104varargout{1}=[0 0 0];%default
105if ~isequal(handles.output,'Cancel')
106    x_shift=str2num(get(handles.Phi,'String'));
107    y_shift=str2num(get(handles.x_0,'String'));
108    z_shift=str2num(get(handles.y_0,'String'));
109    if ~isempty(x_shift)
110        varargout{1}(1)=x_shift;
111    end
112    if ~isempty(y_shift)
113        varargout{1}(2)=y_shift;
114    end
115    if ~isempty(z_shift)
116        varargout{1}(3)=z_shift;
117    end
118end
119% The figure can be deleted now
120delete(handles.figure1);
121
122% --- Executes on button press in OK.
123function OK_Callback(hObject, eventdata, handles)
124handles.output = get(hObject,'String');
125guidata(hObject, handles);% Update handles structure
126uiresume(handles.figure1);
127
128% --- Executes on button press in Cancel.
129function Cancel_Callback(hObject, eventdata, handles)
130handles.output = get(hObject,'String');
131%handles.output = 'Cancel'
132guidata(hObject, handles); % Update handles structure
133% Use UIRESUME instead of delete because the OutputFcn needs
134% to get the updated handles structure.
135uiresume(handles.figure1);
136
137% --- Executes when user attempts to close figure1.
138function figure1_CloseRequestFcn(hObject, eventdata, handles)
139if isequal(get(handles.figure1, 'waitstatus'), 'waiting')
140    % The GUI is still in UIWAIT, us UIRESUME
141    uiresume(handles.figure1);
142else
143    % The GUI is no longer waiting, just close it
144    delete(handles.figure1);
145end
146
147% --- Executes on key press over figure1 with no controls selected.
148function figure1_KeyPressFcn(hObject, eventdata, handles)
149% Check for "enter" or "escape"
150if isequal(get(hObject,'CurrentKey'),'escape')
151    % User said no by hitting escape
152    handles.output = 'Cancel';
153   
154    % Update handles structure
155    guidata(hObject, handles);
156   
157    uiresume(handles.figure1);
158end
159if isequal(get(hObject,'CurrentKey'),'return')
160    uiresume(handles.figure1);
161end   
162
163
164
165
166
Note: See TracBrowser for help on using the repository browser.