summaryrefslogtreecommitdiff
path: root/gui_win.m
diff options
context:
space:
mode:
Diffstat (limited to 'gui_win.m')
-rw-r--r--gui_win.m36
1 files changed, 26 insertions, 10 deletions
diff --git a/gui_win.m b/gui_win.m
index 9e42d69..2193b97 100644
--- a/gui_win.m
+++ b/gui_win.m
@@ -69,7 +69,6 @@ global image_display;
global image_original;
global image_cleaned;
global image_fitted;
-global image_cross;
global default_data_path;
default_data_path='Z:\beam_profiler_images';
@@ -80,7 +79,6 @@ image_display = 0;
image_original = 0;
image_cleaned = 0;
image_fitted = 0;
-image_cross = 0;
isworking = 0;
% Don`t show ticks for the minor windows
@@ -113,8 +111,6 @@ varargout{1} = handles.output;
function display_stuff(handles)
global image_display;
-global background_m;
-
[Ny, Nx] = size(image_display);
@@ -225,7 +221,7 @@ hold off;
% update cross marks
show_cross_marks(handles)
-
+%The function to subtract/add the background when necessary
function img_new=subtract_background(handles,img)
global background_m;
if get(handles.button2subtract_backround,'Value')
@@ -235,8 +231,13 @@ else
set(handles.button2subtract_backround,'String','OFF');
img_new = img;
end;
+%We handle only the original image, the cleaned/fitted image are untouched
set(handles.chooseoriginal,'Value',1);
+
+%When a new image is displayed, make sure that the background is subtracted
+%when we want to
+
function grab_image_and_update_display(handles)
global image_display;
global image_original;
@@ -314,7 +315,17 @@ global isworking;
global image_display;
global image_original;
global pathname;
+
+%When a new image appears, the cleaned/fitted image of the old one will be
+%nulled.
+global image_cleaned;
+global image_fitted;
+image_cleaned = 0;
+image_fitted = 0;
+
isworking =1;
+
+%The new image is the original one
set(handles.chooseoriginal,'Value',1);
% This calls a file-open dialog and runs the beam profiler on the choosen
@@ -353,14 +364,12 @@ function button2clean_Callback(hObject, eventdata, handles)
global isworking;
global image_display;
global image_cleaned;
-global image_negative;
-global background_m;
if (~isworking)
isworking = 1;
set(handles.button2clean,'String','Working');
- %read the attenuation from the GUI
+ %read the attenuation and filter range from the GUI
filter = str2num(get(handles.readstrength,'String'));
radius = str2num(get(handles.readrange,'String'));
@@ -396,6 +405,7 @@ if (~isworking)
isworking = 1;
set(handles.button2fit,'String','Working');
+ %choose the coordinates we set as center
axes(handles.image2display);
[x,y] = ginput(1);
cx = x(1);
@@ -520,7 +530,7 @@ set(handles.backgrounddisplay,'PlotBoxAspectRatio',[Nx Ny 1],'DataAspectRatio',[
display_stuff(handles);
-% This executes when we want to grab the background from the camera
+% This executes when we want to use the displayed image as the background
% --- Executes on button press in use_currently_displayed_as_background.
function use_currently_displayed_as_background_Callback(hObject, eventdata, handles)
% hObject handle to use_currently_displayed_as_background (see GCBO)
@@ -548,7 +558,7 @@ if ~any(isnan(img))
draw_backround_image(handles);
end
-
+%When we open an existing image file
function img=choose_and_read_image_from_file()
global pathname;
global default_data_path;
@@ -715,7 +725,13 @@ function displaychoise_CreateFcn(hObject, eventdata, handles)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
+
+
+
%Choose imgae to display
+%When we switch between the original, cleaned or fitted image, this
+%function changes the display.
+%When the chosen image doesn't exist, go back to the original image.
% --- Executes when selected object is changed in displaychoise.
function displaychoise_SelectionChangeFcn(hObject, eventdata, handles)