2222
2323% Edit the above text to modify the response to help Camera_stage_review
2424
25- % Last Modified by GUIDE v2.5 29-Jun-2015 15:59:11
25+ % Last Modified by GUIDE v2.5 25-Apr-2016 16:52:17
2626
2727% Begin initialization code - DO NOT EDIT
2828gui_Singleton = 1 ;
@@ -54,24 +54,18 @@ function Camera_stage_review_OpeningFcn(hObject, eventdata, handles, varargin)
5454% varargin command line arguments to Camera_stage_review (see VARARGIN)
5555
5656% Choose default command line output for Camera_stage_review
57- settings.mag_cam= 1 ;
58- settings.cam_pixel_size= 6.9 ;
59- settings.cam_format= char(' RGB24_1024x768' );
60- settings.reticleID= char(' KR-871' );
61- settings.cam_mask = reticle_make_mask(...
62- settings .reticleID ,...
63- settings .cam_pixel_size / settings .mag_cam ,...
64- [0 ,0 ]);
65- handles.cam= camera_open(settings .cam_format );
66- camera_image_display(handles ,handles .cam ,settings );
67- handles.imagenumber = 1 ;
68- handles.position_flag_y= 0 ;
69- handles.position_flag_x= 0 ;
70- handles.stageflag= 0 ;
71- handles.firsttime = 1 ;
72- handles.output= hObject ;
73- % Update handles structure
74- guidata(hObject , handles );
57+ desc = {' \b fWelcome' ...
58+ ,' Please choose the camera format' };
59+ welcome_page(handles ,desc ) ;
60+ set(handles .Take_image ,' Enable' ,' off' );
61+ handles.imagenumber = 1 ;
62+ handles.position_flag_y= 0 ;
63+ handles.position_flag_x= 0 ;
64+ handles.stageflag= 0 ;
65+ handles.firsttime = 1 ;
66+ handles.output= hObject ;
67+ % Update handles structure
68+ guidata(hObject , handles );
7569end
7670
7771% UIWAIT makes Camera_stage_review wait for user response (see UIRESUME)
@@ -266,15 +260,17 @@ function Choose_System_Callback(hObject, eventdata, handles)
266260mode_index = get(handles .Choose_System , ' Value' );
267261mode_desc = deblank(modes{mode_index });
268262handles.mode_desc = mode_desc ;
269- handles.stage= stage_open(mode_desc );
270- handles.stage = stage_set_origin(handles .stage );
271- handles.stage= stage_move(handles .stage ,[50000 ,50000 ]);
272- set(handles .Get_position ,' Enable' ,' on' );
273- set(handles .current_position_x ,' Enable' ,' on' );
274- set(handles .current_position_y ,' Enable' ,' on' );
275- set(handles .target_position_x ,' Enable' ,' on' );
276- set(handles .target_position_y ,' Enable' ,' on' );
277- handles.stageflag= 1 ;
263+ if mode_index ~= 1
264+ addpath(' stages/Prior' ,' stages/Ludl' );
265+ handles.stage= stage_open(mode_desc );
266+ handles.stage = stage_set_origin(handles .stage );
267+ set(handles .Get_position ,' Enable' ,' on' );
268+ set(handles .current_position_x ,' Enable' ,' on' );
269+ set(handles .current_position_y ,' Enable' ,' on' );
270+ set(handles .target_position_x ,' Enable' ,' on' );
271+ set(handles .target_position_y ,' Enable' ,' on' );
272+ handles.stageflag= 1 ;
273+ end
278274guidata(hObject , handles );
279275end
280276
@@ -299,7 +295,9 @@ function camera_image_display(handles,vid, settings)
299295 imWidth = vidRes(1 );
300296 imHeight = vidRes(2 );
301297 set(handles .ImageAxes ,' Units' , ' pixels' )
302- set(handles .ImageAxes ,' Position' , [5 , 5 , imWidth , imHeight ]);
298+ startWidth = floor((1252 - imWidth )/2 );
299+ startHeight = floor((1051 - imHeight )/2 );
300+ set(handles .ImageAxes ,' Position' , [startWidth , startHeight , imWidth , imHeight ]);
303301 hImage = image( uint8(zeros(imHeight , imWidth , nBands ) ),' parent' , handles .ImageAxes );
304302 set(hImage , ' UserData' , settings )
305303 setappdata(hImage ,' UpdatePreviewWindowFcn' ,@preview_image_with_cross );
@@ -347,5 +345,83 @@ function preview_image_with_cross(obj, event, himage)
347345end
348346
349347
348+ % --- Choose camera format
349+ function Choose_Camera_Callback(hObject , eventdata , handles )
350+ try
351+ settings.mag_cam= 1 ;
352+ settings.cam_pixel_size= 6.9 ;
353+ modes= get(handles .Choose_Camera ,' String' );
354+ mode_index = get(handles .Choose_Camera , ' Value' );
355+ cam_mode = deblank(modes{mode_index });
356+ if mode_index ~= 1
357+ handles.cam_mode = cam_mode ;
358+ if strcmp(handles .cam_mode(1 : 3 ),' USB' )
359+ settings.cam_kind = char(' USB' );
360+ settings.cam_format= char(' F7_RGB_1224x1024_Mode1' );
361+ else
362+ settings.cam_kind = char(' Firewire' );
363+ settings.cam_format= char(' RGB24_1024x768' );
364+ end
365+ settings.reticleID= char(' KR-871' );
366+ settings.cam_mask = reticle_make_mask(...
367+ settings .reticleID ,...
368+ settings .cam_pixel_size / settings .mag_cam ,...
369+ [0 ,0 ]);
370+ handles.cam= camera_open(settings .cam_kind ,settings .cam_format );
371+ camera_image_display(handles ,handles .cam ,settings );
372+ set(handles .Take_image ,' Enable' ,' on' );
373+ else
374+ desc = {' \b fWelcome' ...
375+ ,' Please choose the camera format' };
376+ welcome_page(handles , desc );
377+ set(handles .Take_image ,' Enable' ,' off' );
378+ end
379+ guidata(hObject , handles );
380+ catch ME
381+ error_show(ME )
382+ end
350383
384+ end
385+
386+ % --- Executes during object creation, after setting all properties.
387+ function Choose_Camera_CreateFcn(hObject , eventdata , handles )
388+ % hObject handle to Choose_Camera (see GCBO)
389+ % eventdata reserved - to be defined in a future version of MATLAB
390+ % handles empty - handles not created until after all CreateFcns called
351391
392+ % Hint: popupmenu controls usually have a white background on Windows.
393+ % See ISPC and COMPUTER.
394+ if ispc && isequal(get(hObject ,' BackgroundColor' ), get(0 ,' defaultUicontrolBackgroundColor' ))
395+ set(hObject ,' BackgroundColor' ,' white' );
396+ end
397+ end
398+ function welcome_page(handles , desc )
399+ try
400+ % This function creates an image with text to be displayed to the user
401+ set(handles .ImageAxes ,...
402+ ' Units' , ' pixels' ,...
403+ ' Position' , [1 , 1 , 1252 , 1051 ],...
404+ ' Visible' , ' off' );
405+ position = int64(get(handles .ImageAxes , ' Position' ));
406+ temp_image = ones([position(4 ), position(3 ), 3 ])-.5 ;
407+ i= (1 : double(position(3 )))/double(position(3 ));
408+ for j= 1 : position(4 )
409+ temp_image(j ,: ,1 ) = i ;
410+ end
411+ img_object = image(temp_image , ' Parent' , handles .ImageAxes ); % #ok<NASGU>
412+ axis image
413+ set(handles .ImageAxes , ' Visible' , ' off' );
414+ fontsize= 0.05 ;
415+ text(' Parent' , handles .ImageAxes ,...
416+ ' FontName' , ' Times' ,...
417+ ' FontUnits' , ' normalized' ,...
418+ ' FontSize' , fontsize ,...
419+ ' HorizontalAlignment' , ' center' ,...
420+ ' VerticalAlignment' , ' middle' ,...
421+ ' Position' , [position(3 )/2 , position(4 )/2 ],...
422+ ' String' , desc );
423+
424+ catch ME
425+ error_show(ME )
426+ end
427+ end
0 commit comments