Contents
INITIALIZE GUI
back to top

function varargout = NMJ_GUI(varargin) % NMJ_GUI MATLAB code for NMJ_GUI.fig % NMJ_GUI, by itself, creates a new NMJ_GUI or raises the existing % singleton*. % % H = NMJ_GUI returns the handle to a new NMJ_GUI or the handle to % the existing singleton*. % % NMJ_GUI('CALLBACK',hObject,eventData,handles,...) calls the local % function named CALLBACK in NMJ_GUI.M with the given input arguments. % % NMJ_GUI('Property','Value',...) creates a new NMJ_GUI or raises the % existing singleton*. Starting from the left, property value pairs are % applied to the GUI before NMJ_GUI_OpeningFcn gets called. An % unrecognized property name or invalid value makes property application % stop. All inputs are passed to NMJ_GUI_OpeningFcn via varargin. % % *See GUI Options on GUIDE's Tools menu. Choose "GUI allows only one % instance to run (singleton)". % % See also: GUIDE, GUIDATA, GUIHANDLES % Edit the above text to modify the response to help NMJ_GUI % Last Modified by GUIDE v2.5 17-Jun-2014 17:54:26 % Begin initialization code - DO NOT EDIT gui_Singleton = 1; gui_State = struct('gui_Name', mfilename, ... 'gui_Singleton', gui_Singleton, ... 'gui_OpeningFcn', @NMJ_GUI_OpeningFcn, ... 'gui_OutputFcn', @NMJ_GUI_OutputFcn, ... 'gui_LayoutFcn', [] , ... 'gui_Callback', []); if nargin && ischar(varargin{1}) gui_State.gui_Callback = str2func(varargin{1}); end if nargout [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:}); else gui_mainfcn(gui_State, varargin{:}); end % End initialization code - DO NOT EDIT % --- Executes just before NMJ_GUI is made visible. function NMJ_GUI_OpeningFcn(hObject, eventdata, handles, varargin) % This function has no output args, see OutputFcn. % hObject handle to figure % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % varargin command line arguments to NMJ_GUI (see VARARGIN) % Choose default command line output for NMJ_GUI handles.output = hObject; % Update handles structure guidata(hObject, handles); % UIWAIT makes NMJ_GUI wait for user response (see UIRESUME) % uiwait(handles.figure1); %add paths to control, iso2mesh, and images folders addpath(genpath([cd,'\control'])); addpath(genpath([cd,'\iso2mesh'])); addpath(genpath([cd,'\images'])); %load images from images folder evalin('base','loadmyimages') %Pass the images to the GUI, filter and draw MyI = evalin('base','MyI'); % h = fspecial('disk',1); %make filter template % for k = 1:size(MyI,3); %loop through images % MyIfilt(:,:,k) = filter2(h,double(MyI(:,:,k))); %filter image % end % MyIfilt = uint8(MyIfilt); % assignin('base','MyIfilt',MyIfilt);%save filtered images to workspace MyIfilt = myfilter(MyI); assignin('base','MyIfilt',MyIfilt);%save filtered images to workspace axes(handles.axes1); %activate axes1 imagesc(MyI(:,:,1));colormap(pink);axis off; %draw on axes1 set(handles.axes1,'visible','off') axes(handles.axes2); %activate axes2 axis off; set(handles.axes2,'visible','off') axes(handles.axes3); %activate axes3 axis off; set(handles.axes3,'visible','off') %Populate List Box with array of image numbers temp = 1:size(MyI,3); %make array temp = temp'; %transpose A = cellstr(num2str(temp)); %make cellstring MyString = A; set(handles.listbox1,'String',MyString); %populate listbox1 assignin('base','MyString',MyString); %write string to work space % %Set parameters for slider1 % mymax = evalin('base','size(MyI,3)'); % mystep = [1,1]/(mymax - 1); % set(handles.slider1,'Min',1); % set(handles.slider1,'Max',mymax); % set(handles.slider1,'SliderStep', mystep); % set(handles.slider1,'Value',1); % set(handles.slider1,'interruptible','off'); %Set parameters for slider2 mymax = 1; mymin = 0; mystep = [.01,.1]; set(handles.slider2,'Min',mymin); set(handles.slider2,'Max',mymax); set(handles.slider2,'SliderStep', mystep); set(handles.slider2,'Value',1); set(handles.slider2,'interruptible','off'); slider2pos = get(handles.slider2,'Value'); set(handles.text6,'String',num2str(slider2pos)); %Initialize variables stored to workspace applycrop = 0; Roiring = 0; BwMask = []; xi = 0; yi = 0; gofilt = 0; ThreshLevel = []; assignin('base','applycrop',applycrop); %initialize applycrop to 0 in workspace assignin('base','Roiring',Roiring); %initialize Roiring to 0 in workspace assignin('base','BwMask',BwMask); %initialize BwMask mask to empty in workspace assignin('base','xi',xi); assignin('base','yi',yi); assignin('base','gofilt',gofilt); %initialize the filter option to 0 assignin('base','ThreshLevel',ThreshLevel); %initialize ThreshLevel array % --- Outputs from this function are returned to the command line. function varargout = NMJ_GUI_OutputFcn(hObject, eventdata, handles) % varargout cell array for returning output args (see VARARGOUT); % hObject handle to figure % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Get default command line output from handles structure %get(handles.slider1)%dilspay the slider properties in matlab window varargout{1} = handles.output; % --- Executes during object creation, after setting all properties. function listbox1_CreateFcn(hObject, eventdata, handles) % hObject handle to listbox1 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles empty - handles not created until after all CreateFcns called % Hint: listbox controls usually have a white background on Windows. % See ISPC and COMPUTER. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white'); end % --- Executes on key press with focus on listbox1 and none of its controls. function listbox1_KeyPressFcn(hObject, eventdata, handles) % hObject handle to listbox1 (see GCBO) % eventdata structure with the following fields (see UICONTROL) % Key: name of the key that was pressed, in lower case % Character: character interpretation of the key(s) that was pressed % Modifier: name(s) of the modifier key(s) (i.e., control, shift) pressed % handles structure with handles and user data (see GUIDATA) % --- Executes during object creation, after setting all properties. function slider2_CreateFcn(hObject, eventdata, handles)
% hObject handle to slider2 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: slider controls usually have a light gray background.
if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor',[.9 .9 .9]);
end
% --- Executes on button press in checkbox3.
FILTER CHECKBOX
back to top


function checkbox3_Callback(hObject, eventdata, handles)
% hObject handle to checkbox3 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
set(handles.checkbox3,'enable','off'); %disable filter
assignin('base','gofilt',1); %set gofilt variable to true
evalin('base','clear MyI; MyI = MyIfilt;'); %use filtered images
MyI = evalin('base','MyI'); %load images to UI
contentL = get(handles.listbox1,'Value'); %get position on list box
%Update Plot on axes1
axes(handles.axes1); %activate axes1
set(handles.axes1,'visible','off')
imagesc(MyI(:,:,contentL));colormap(pink); %update plot
set(handles.radiobutton1,'enable','on'); %enable Crop
% --- Executes on selection change in listbox1.
IMAGE LISTBOX
back to top
function listbox1_Callback(hObject, eventdata, handles)
% hObject handle to listbox1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: contents = cellstr(get(hObject,'String')) returns listbox1 contents as cell array
% contents{get(hObject,'Value')} returns selected item from listbox1
MyI = evalin('base','MyI'); %load images to UI
contentL = get(handles.listbox1,'Value'); %get position on list box
%slider1pos = get(handles.slider1,'Value'); %get slider position
applycrop = evalin('base','applycrop'); %get applycrop value
BwMask = evalin('base','BwMask'); %get BwMask mask value
Roiring = evalin('base','Roiring'); %get Roiring value
% if contentL ~= slider1pos; %check if slider positin and list box positin mismatch
% set(handles.slider1,'Value',contentL); %update slider
% end
%Update Plots
if applycrop == 1 && ~isempty(BwMask) && Roiring == 1
xi = evalin('base','xi'); %get Roiring xi coordinates
yi = evalin('base','yi'); %get Roiring yi coordinates
MyIcropsc = evalin('base','MyIcropsc'); %get copped scaled images
MyIBw = evalin('base','MyIBw'); %get cropped scaled binary images
ThreshLevel = evalin('base','ThreshLevel'); %get ThreshLevel
ThreshLevel = ThreshLevel(contentL); %get index ThreshLevel
axes(handles.axes1); %activate axes1
set(handles.axes1,'visible','off')
imagesc(MyI(:,:,contentL));colormap(pink); %update plot
hold on;
plot(xi,yi); %show roi
hold off;
axes(handles.axes2); %activate axes2
set(handles.axes2,'visible','off')
imagesc(MyIcropsc(:,:,contentL));colormap(pink); %display the cropped image
axes(handles.axes3); %activate axes3
set(handles.axes3,'visible','off')
imagesc(MyIBw(:,:,contentL));colormap(pink); %dispaly binary image
set(handles.slider2,'Value',ThreshLevel); %update ThreshLevel slider
set(handles.text6,'String',num2str(ThreshLevel)); %update the Threshlevel numeric indicator
elseif applycrop == 1 && ~isempty(BwMask) && Roiring == 0
MyIcropsc = evalin('base','MyIcropsc'); %copped scaled images
MyIBw = evalin('base','MyIBw'); %cropped scaled binary images
ThreshLevel = evalin('base','ThreshLevel'); %get ThreshLevel
ThreshLevel = ThreshLevel(contentL); %get index ThreshLevel
axes(handles.axes1); %activate axes1
set(handles.axes1,'visible','off')
imagesc(MyI(:,:,contentL));colormap(pink); %update plot
axes(handles.axes2); %activate axes2
set(handles.axes2,'visible','off')
imagesc(MyIcropsc(:,:,contentL));colormap(pink); %display the cropped image
axes(handles.axes3); %activate axes3
set(handles.axes3,'visible','off')
imagesc(MyIBw(:,:,contentL));colormap(pink); %dispaly binary image
set(handles.slider2,'Value',ThreshLevel); %update ThreshLevel slider
set(handles.text6,'String',num2str(ThreshLevel)); %update the Threshlevel numeric indicator
elseif applycrop == 0 && ~isempty(BwMask) && Roiring == 1
xi = evalin('base','xi'); %get Roiring xi coordinates
yi = evalin('base','yi'); %get Roiring yi coordinates
axes(handles.axes1); %activate axes1
set(handles.axes1,'visible','off')
imagesc(MyI(:,:,contentL));colormap(pink); %update plot
hold on;
plot(xi,yi); %show roi
hold off;
elseif applycrop == 0 && isempty(BwMask) && Roiring == 1
xi = evalin('base','xi'); %get Roiring xi coordinates
yi = evalin('base','yi'); %get Roiring yi coordinates
axes(handles.axes1); %activate axes1
set(handles.axes1,'visible','off')
imagesc(MyI(:,:,contentL));colormap(pink); %update plot
hold on;
plot(xi,yi); %show roi
hold off;
else
axes(handles.axes1); %activate first axes
set(handles.axes1,'visible','off')
imagesc(MyI(:,:,contentL));colormap(pink); %update plot
end
% --- Executes on button press in radiobutton1.
CROP BUTTON
back to top


function radiobutton1_Callback(hObject, eventdata, handles)
% hObject handle to radiobutton1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hint: get(hObject,'Value') returns toggle state of radiobutton1
MyI = evalin('base','MyI'); %load images to UI
contentL = get(handles.listbox1,'Value'); %get position on list box
axes(handles.axes1); %activate axes1
set(handles.axes1,'visible','off')
[BwMask, xi, yi] = roipoly; %use builtin roi selection tool
assignin('base','xi',xi); %write the xi coordinates of roi ring to workspace
assignin('base','yi',yi); %write the xi coordinates of roi ring to workspace
assignin('base','BwMask',BwMask); %write the BwMask mask to workspace
set(handles.radiobutton1,'Value',0); %reset radio button
set(handles.radiobutton1,'enable','off'); %turn off crop
set(handles.checkbox3,'enable','off'); %turn off filter
disp('Cropped'); %show text in command prompt
%crop the original image stack
for k = 1:size(MyI,3);
MyIcrop(:,:,k) = double(MyI(:,:,k)).*double(BwMask); %apply image mask to each image
end
MyIcrop = uint8(MyIcrop);
assignin('base','MyIcrop',MyIcrop); %save cropped stack to workspace
%scale the cropped image stack and save to workspace
MyIcropsc = zeros(size(MyIcrop),'uint8'); %make a copy of MyIcrop filled with zeros
MyIcropscd = double(MyIcropsc(:,:,1)); %make a single image but change the numeric signature
for k = 1:size(MyIcrop,3); %go through each image
MyIcropscd(:,:,1) = double(MyIcrop(:,:,k)) - min(min(double(MyIcrop(:,:,k)))); %zero the range dimest pixel
MyIcropsc(:,:,k) = uint8(MyIcropscd * 255 / (max(MyIcropscd(:)))); %scale the pixel intensity in zeroed image 0-255
end
clear MyIcropscd;
assignin('base','MyIcropsc',MyIcropsc); %save the cropped & scaled image stack to workspace
%perform binary operations on cropped image stack and save to workspace
MyIBw = logical(MyIcropsc); %preallocate matrix
se = strel('disk',3); %filter disk
ThreshLevel = evalin('base','ThreshLevel'); %pass ThreshLeval array
for k = 1:size(MyIBw,3);
ThreshLevel(k) = graythresh(MyIcropsc(:,:,k)); %threshold pixels
MyIBwtemp = im2bw(MyIcropsc(:,:,k),ThreshLevel(k)); %convert to binary image
MyIBwtemp = bwareaopen(MyIBwtemp,200); %delete small objects
MyIBw(:,:,k) = imclose(MyIBwtemp,se); %get rid of samll holes in objects
end
assignin('base','MyIBw',MyIBw); %write binary data to workspace
assignin('base','ThreshLevel',ThreshLevel); %write the initial Threshlevels to workspace
axes(handles.axes2); %activate axes2
set(handles.axes2,'visible','off')
imagesc(MyIcropsc(:,:,contentL));colormap(pink); %display the cropped image
axes(handles.axes3); %activate axes3
set(handles.axes3,'visible','off')
imagesc(MyIBw(:,:,contentL));colormap(pink); %dispaly binary image
set(handles.checkbox1,'enable','on');%enable Roi Ring
set(handles.checkbox2,'enable','on');%enable Apply Crop
set(handles.slider2,'enable','on');%enable ThreshLevel slider
myThreshLevel = ThreshLevel(contentL); %get value of current image ThreshLevel
set(handles.slider2,'Value',myThreshLevel); %update ThreshLevel slider
set(handles.text6,'String',num2str(myThreshLevel)); %update the Threshlevel numeric indicator
set(handles.togglebutton3,'enable','on'); %apply Threshold
set(handles.togglebutton4,'enable','on'); %apply all Threshold
set(handles.checkbox2,'value',1); %change state of apply crop
assignin('base','applycrop',1); %write state of apply crop to workspace
set(handles.checkbox2,'enable','off'); %disable apply crop visibility
% --- Executes on button press in checkbox1.
ROI RING CHECKBOX
back to top
function checkbox1_Callback(hObject, eventdata, handles)
% hObject handle to checkbox1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
Roiring = get(handles.checkbox1,'Value');
assignin('base','Roiring',Roiring);
if Roiring == 0;
axes(handles.axes1); %activate axes1
set(handles.axes1,'visible','off')
MyI = evalin('base','MyI'); %load images to UI
contentL = get(handles.listbox1,'Value'); %get position on list box
imagesc(MyI(:,:,contentL));colormap(pink); %update plot
else
axes(handles.axes1); %activate axes1
set(handles.axes1,'visible','off')
MyI = evalin('base','MyI'); %load images to UI
contentL = get(handles.listbox1,'Value'); %get position on list box
imagesc(MyI(:,:,contentL));colormap(pink); %update plot
hold on; %stack subsequent drawings on axes
xi = evalin('base', 'xi'); %pass the x-row coordinates of roi
yi = evalin('base', 'yi'); %pass the y-column coordinates of roi
plot(xi,yi,'b-');%plot the roi ring
hold off;
end
% --- Executes on button press in checkbox2.
APPLY CROP CHECKBOX
back to top
function checkbox2_Callback(hObject, eventdata, handles)
% hObject handle to checkbox2 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
applycrop = get(handles.checkbox2,'Value'); %get value of checkbox
assignin('base','applycrop',applycrop); %write updated applycrop value to workspace
set(handles.checkbox2,'enable','off'); %set visibilty for apply crop option
% --- Executes on slider movement.
BINARY THRESHOLD
back to top


function slider2_Callback(hObject, eventdata, handles)
% hObject handle to slider2 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
slider2pos = get(handles.slider2,'Value'); %new ThreshLevel
set(handles.text6,'String',num2str(slider2pos)); %update display box
contentL = get(handles.listbox1,'Value'); %get position on list box
assignin('base','contentL',contentL); %create contentL varible in workspace
MyIcropsc = evalin('base','MyIcropsc(:,:,contentL)'); %load cropped scaled images
%perform binary operations on cropped image stack and save to workspace
se = strel('disk',3); %filter disk
ThreshLevel = slider2pos; %threshold pixels
MyIBwtemp = im2bw(MyIcropsc,ThreshLevel); %make binary image
MyIBwtemp = bwareaopen(MyIBwtemp,200); %delete small objects
MyIBw = imclose(MyIBwtemp,se); %get rid of samll holes in objects
axes(handles.axes3); %activate axes3
set(handles.axes3,'visible','off')
imagesc(MyIBw);colormap(pink); %dispaly binary image
% --- Executes on button press in togglebutton3.
APPLY THRESHOLD
back to top
function togglebutton3_Callback(hObject, eventdata, handles)
% hObject handle to togglebutton3 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hint: get(hObject,'Value') returns toggle state of togglebutton3
slider2pos = get(handles.slider2,'Value'); %new ThreshLevel
contentL = get(handles.listbox1,'Value'); %get position on list box
assignin('base','contentL',contentL); %create contentL varible in workspace
MyIcropsc = evalin('base','MyIcropsc(:,:,contentL)'); %load cropped scaled images
%perform binary operations on cropped image stack and update workspace
se = strel('disk',3); %filter disk
ThreshLevel = slider2pos; %threshold pixels
MyIBwtemp = im2bw(MyIcropsc,ThreshLevel); %make binary image
MyIBwtemp = bwareaopen(MyIBwtemp,200); %delete small objects
MyIBw = imclose(MyIBwtemp,se); %get rid of samll holes in objects
assignin('base','ThreshLeveltemp',ThreshLevel); %write temp ThreshLevel to workspace
assignin('base','MyIBwtemp',MyIBw); %write temp binary data to workspace
evalin('base','ThreshLevel(contentL) = ThreshLeveltemp;'); %save selected ThreshLevel to current image
evalin('base', 'MyIBw(:,:,contentL) = MyIBwtemp;'); %write binary data to workspace
set(hObject,'Value',0); %reinitialize to 0
% --- Executes on button press in togglebutton4.
APPLY ALL THRESHOLD
back to top
function togglebutton4_Callback(hObject, eventdata, handles)
% hObject handle to togglebutton4 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hint: get(hObject,'Value') returns toggle state of togglebutton4
slider2pos = get(handles.slider2,'Value'); %new ThreshLevel
contentL = get(handles.listbox1,'Value'); %get position on list box
assignin('base','contentL',contentL); %create contentL varible in workspace
MyIcropsc = evalin('base','MyIcropsc'); %load cropped scaled images
%perform binary operations on cropped image stack and update workspace
se = strel('disk',3); %filter disk
ThreshLevel = slider2pos; %threshold pixels
MyIBw = logical(MyIcropsc); %initialize matrix
for k = 1:size(MyIcropsc,3);
MyIBwtemp = im2bw(MyIcropsc(:,:,k),ThreshLevel); %make binary image
MyIBwtemp = bwareaopen(MyIBwtemp,200); %delete small objects
MyIBw(:,:,k) = imclose(MyIBwtemp,se); %get rid of samll holes in objects
end
ThreshLevel = ThreshLevel*ones(size(MyIBw,3),1);
assignin('base','ThreshLevel',ThreshLevel); %write temp ThreshLevel to workspace
assignin('base','MyIBw',MyIBw); %write temp binary data to workspace
set(hObject,'Value',0); %reinitialize to 0
% --- Executes on button press in togglebutton1.
RESET BUTTON
back to top
function togglebutton1_Callback(hObject, eventdata, handles)
% hObject handle to togglebutton1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
applycrop = 0;
Roiring = 0;
BwMask = [];
xi = 0;
yi = 0;
gofilt = 0;
ThreshLevel = [];
assignin('base','applycrop',applycrop); %initialize applycrop to false in workspace
assignin('base','Roiring',Roiring); %initialize Roiring to false in workspace
assignin('base','BwMask',BwMask); %initialize BwMask mask to empty in workspace
assignin('base','xi',xi); %assign roi x-coordinates
assignin('base','yi',yi); %assign roi y-coordinates
assignin('base','gofilt',gofilt); %rest filter to false
assignin('base','ThreshLevel',ThreshLevel); %reset ThreshLevel array
evalin('base','clear MyI; MyI = I;'); %reset MyI data to I, restore original images for displays
MyI = evalin('base','MyI');
axes(handles.axes1); %activate axes1
set(handles.axes1,'visible','off')
imagesc(MyI(:,:,1));colormap(pink);axis off; %draw on axes1
%set(handles.slider1,'Value',1); %set image slider to 1
set(handles.listbox1,'Value',1); %set image listbox to 1
axes(handles.axes2); %activate axes2
set(handles.axes2,'visible','off')
cla;
axis off;
axes(handles.axes3); %activate axes3
set(handles.axes3,'visible','off')
cla;
axis off;
set(handles.radiobutton1,'Value',0); %crop
set(handles.checkbox1,'Value',0); %Roi ring
set(handles.checkbox2,'Value',0); %apply crop
set(handles.checkbox3,'Value',0); %filter
set(handles.checkbox1,'enable','off'); %disable Roi ring
set(handles.checkbox2,'enable','off'); %disable Apply crop
set(handles.slider2,'enable','off'); %disable binary threshold
set(handles.togglebutton3,'enable','off'); %disable apply Threshold
set(handles.togglebutton4,'enable','off'); %disable apply all Threshold
set(handles.checkbox3,'enable','on'); %enable filter
set(handles.radiobutton1,'enable','on'); %enable Crop
set(hObject,'Value',0); %reinitialize to 0
disp('reset')
% --- Executes on button press in pushbutton1.
FINISHED BUTTON
back to top

function pushbutton1_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
set(handles.checkbox1,'enable','off'); %disable Roi ring
set(handles.checkbox2,'enable','off'); %disable Apply crop
set(handles.slider2,'enable','off'); %disable binary threshold
set(handles.togglebutton3,'enable','off'); %disable apply Threshold
set(handles.togglebutton4,'enable','off'); %disable apply all Threshold
set(handles.checkbox3,'enable','off'); %enable filter
set(handles.radiobutton1,'enable','off'); %enable Crop
set(handles.listbox1,'enable','off'); %disable image scroll
set(handles.text1,'visible','off');
set(handles.text2,'visible','off');
set(handles.text3,'visible','off');
set(handles.text4,'visible','off');
set(handles.text5,'visible','off');
set(handles.text6,'visible','off');
set(handles.togglebutton1,'visible','off');
set(handles.pushbutton1,'visible','off');
set(handles.axes1,'visible','off')
axes(handles.axes1); cla; %clear axes3
set(handles.axes2,'visible','off')
axes(handles.axes2); cla;%clear axes3
set(handles.axes3,'visible','off')
axes(handles.axes3); cla;%clear axes3
evalin('base', 'clear BwMask I MyI MyIBw MyIBwtemp MyIcrop MyIfilt'); %clear large unnecessary variables
% --- Executes on button press in pushbutton2.
CONSTRUCT BUTTON
back to top


function pushbutton2_Callback(hObject, eventdata, handles)
%call the interpolation function
o = 'This will take a while...';
assignin('base','o',o);
oo = 'Wait...';
assignin('base','oo',oo);
evalin('base', 'disp(o)');
evalin('base', 'Iinterp = myIinterp(MyIcropsc,ThreshLevel);' );
%call the construct function
evalin('base', 'disp(oo)');
evalin('base', '[V,SA,h] = myIConstruct(Iinterp);' );