i need to fix errors in interface
3 views (last 30 days)
Show older comments
if true
% code
end
function varargout = sara(varargin)
% global completeu;
% global boundary_image;
% global draw_circle;
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @sara_OpeningFcn, ...
'gui_OutputFcn', @sara_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 sara is made visible.
function sara_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 sara (see VARARGIN)
% Choose default command line output for sara
handles.output = hObject;
% create an axes that spans the whole gui
ah = axes('unit', 'normalized', 'position', [0 0 1 1]);
% import the background image and show it on the axes
bg = imread('ct.jpg'); imagesc(bg);
% prevent plotting over the background and turn the axis off
set(ah,'handlevisibility','off','visible','off')
% making sure the background is behind all the other uicontrols
uistack(ah, 'bottom');
% Update handles structure
guidata(hObject, handles);
% UIWAIT makes sara wait for user response (see UIRESUME)
% uiwait(handles.figure1);
% --- Outputs from this function are returned to the command line.
function varargout = sara_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
varargout{1} = handles.output;
function edit1_Callback(hObject, eventdata, handles)
% hObject handle to edit1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of edit1 as text
% str2double(get(hObject,'String')) returns contents of edit1 as a double
% --- Executes during object creation, after setting all properties.
function edit1_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit 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 button press in pushbutton7.
function pushbutton7_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton7 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global completeu;
handles.output = hObject;
[fn , pn] = uigetfile({'*.jpg';'*.gif'},'select jpg file');
% completeu = strcat(pn,fn);
set(handles.edit1,'string',[pn fn]);
completeu= imread([pn fn]);
% imshow(I,[]);
imshow(completeu);
axes(handles.axes1);
set(handles.axes1,completeu);
guidata(hObject, handles);
% --- Executes on button press in pushbutton2.
function pushbutton2_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton2 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global completeu;
global boundary_image;
boundary_image = extracting(completeu);
axes(handles.axes3);
imshow(boundary_image,[]);
set(handles.axes1,boundary_image);
set(handles.uipanel2,'string','the extracting result')
xlabel('the result of lung region extracting');
% set(handles.axes3,boundary_image);
% --- Executes on button press in pushbutton1.
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)
global boundary_image;
global draw_circle;
draw_circle = circle(boundary_image,1,8);
axes(handles.axes1);
imshow(draw_circle,[]);
set(handles.uipanel2,'string','the segmentation result')
xlabel('the result of lung region segmentation');
% --- Executes on button press in pushbutton3.
function pushbutton3_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton3 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% --- Executes on button press in pushbutton4.
function pushbutton4_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton4 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global draw_circle;
global labeledImage;
labeledImage = measure_object(draw_circle);
axes(handles.axes1);
imshow(labeledImage,[]);
set(handles.uipanel2,'string','"Keeper" blobs (bigger than 5 mm^2 in a re-labeled image)')
xlabel('the result of lung region analysis');
% --- Executes on button press in pushbutton5.
function pushbutton5_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton5 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global draw_circle;
global labeledImage;
global biggrain;
[ labeledImage,allgrains,biggrain] = measure_object(draw_circle);
y = isempty( biggrain);
if y ==1;
x= imread('waad s.jpg');
axes(handles.axes1);
imshow(x);
else
x= imread('waad m.jpg');
axes(handles.axes1);
imshow(x);
end
% --- Executes on button press in pushbutton6.
function pushbutton6_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton6 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global biggrain;
y = isempty( biggrain);
if y ==1;
x= imread('waad s.jpg');
axes(handles.axes1);
imshow(x);
imsave( x)
else
x= imread('waad m.jpg');
axes(handles.axes1);
imshow(x);
filename('waad s.jpg')
imsave(x)
end
i have this error message Undefined function 'filename' for input arguments of type 'char'.
Error in sara>pushbutton6_Callback (line 225) filename('waad s.jpg')
Error in gui_mainfcn (line 96) feval(varargin{:});
Error in sara (line 45) gui_mainfcn(gui_State, varargin{:});
Error in @(hObject,eventdata)sara('pushbutton6_Callback',hObject,eventdata,guidata(hObject))
Error while evaluating uicontrol Callback
i really need help to fix this interface , the last button also does not save image , why?
0 Comments
Answers (3)
Mahdi
on 30 May 2014
Edited: Mahdi
on 30 May 2014
This line:
filename('waad s.jpg')
is not a valid code to put into MATLAB. I am not sure what you're trying to do, but this can fix it:
filename=('waad s.jpg')
I am not sure why you have that line in it (You should remove it). In your button, you're basically opening a picture, showing it in the GUI, and then saving it with a different name? Why is that?
0 Comments
Image Analyst
on 30 May 2014
You need to create a filename, then save it. You're not using the equal sign and not passing the filename into imwrite, which you should use since I've never heard of imsave().
fullFileName= fullfile(pwd, 'waad s.jpg');
imwrite(x, fullFileName);
You should also pick more descriptive variable names than single letters like x, something like grayImage, or rgbImage would be better and let your code be more maintainable by others.
0 Comments
waad almalki
on 30 May 2014
1 Comment
Image Analyst
on 30 May 2014
That could be fine. I just never use imsave(). It looks like a combination of uiputfile() and imwrite() and acts upon the image in the current axes. So get rid of the filename line and it should work.
See Also
Categories
Find more on Matrix Indexing in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!