Why I cannot run the rotate push button

5 次查看(过去 30 天)
function varargout = SurfSuite2(varargin)
% SURFSUITE2 MATLAB code for SurfSuite2.fig
% SURFSUITE2, by itself, creates a new SURFSUITE2 or raises the existing
% singleton*.
%
% H = SURFSUITE2 returns the handle to a new SURFSUITE2 or the handle to
% the existing singleton*.
%
% SURFSUITE2('CALLBACK',hObject,eventData,handles,...) calls the local
% function named CALLBACK in SURFSUITE2.M with the given input arguments.
%
% SURFSUITE2('Property','Value',...) creates a new SURFSUITE2 or raises the
% existing singleton*. Starting from the left, property value pairs are
% applied to the GUI before SurfSuite2_OpeningFcn gets called. An
% unrecognized property name or invalid value makes property application
% stop. All inputs are passed to SurfSuite2_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 SurfSuite2
% Last Modified by GUIDE v2.5 15-May-2020 00:48:23
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @SurfSuite2_OpeningFcn, ...
'gui_OutputFcn', @SurfSuite2_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 SurfSuite2 is made visible.
function SurfSuite2_OpeningFcn(hObject, ~, 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 SurfSuite2 (see VARARGIN)
% Choose default command line output for SurfSuite2
handles.output = hObject;
handles.xNum = 0;
handles.ynum = 0;
handles.dx = 0;
handles.dy = 0;
handles.Z = 0;
handles.Mag = 0;
handles.filterindex = 0;
handles.filename = 0;
handles.path = 0;
handles.pathname = 0;
handles.SNum = 0; %No of Outliers
% Update handles structure
guidata(hObject, handles);
% UIWAIT makes SurfSuite2 wait for user response (see UIRESUME)
% uiwait(handles.figure1);
% --- Outputs from this function are returned to the command line.
function varargout = SurfSuite2_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;
% --- Executes on button press in OpenSurface.
function OpenSurface_Callback(hObject, eventdata, handles)
% hObject handle to OpenSurface (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
[filename, pathname, filterindex] = uigetfile( ...
{'*.sdf','sdf-files (*.sdf)'; ...
'*.kos','summit (*.kos)'; ...
'*.al3d','alicona (*.al3d)'; ...
'*.sp','toray (*.sp)'}, ...
'Pick a file');
if filterindex == 0
return
end
path = [pathname filename];
run OpenSurf.m;
run PLot.m;
run FieldParameter.m;
run SurfUpdate.m
guidata(hObject,handles)
% --- Executes on button press in LinearPlane.
function LinearPlane_Callback(hObject, eventdata, handles)
% hObject handle to LinearPlane (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
run SurfInfo.m;
run F_LSPlane.m;
%run F_resampling.m;
run SurfUpdate.m;
run PLot.m;
run FieldParameter.m;
guidata(hObject,handles)
% --- Executes on button press in GLPF.
function GLPF_Callback(hObject, eventdata, handles)
% hObject handle to GLPF (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
run SurfInfo.m;
Lc = str2double(get(handles.Lc1,'String'));
%Lc = Lc/1000;
Dx = round (Lc/dx);
Dy = round (Lc/dy);
N = Dx/6;
G = fspecial('gaussian',[Dy,Dx],N);
Z = imfilter(Z,G,'symmetric','same'); %averaging filter
run PLot;
run FieldParameter.m;
run SurfUpdate.m;
guidata(hObject,handles)
% --- Executes on button press in GHPF.
function GHPF_Callback(hObject, eventdata, handles)
% hObject handle to GHPF (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
run SurfInfo.m;
Lc = str2double(get(handles.Lc2,'String'));
Dx = round (Lc/dx);
Dy = round (Lc/dy);
N = Dx/6;
G = fspecial('gaussian',[Dy,Dx],N);
Zg = imfilter(Z,G,'symmetric','same'); %averaging filter
Z = Z - Zg;
run PLot;
run FieldParameter.m;
run SurfUpdate.m;
guidata(hObject,handles)
function Lc1_Callback(hObject, eventdata, handles)
% hObject handle to Lc1 (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 Lc1 as text
% str2double(get(hObject,'String')) returns contents of Lc1 as a double
% --- Executes during object creation, after setting all properties.
function Lc1_CreateFcn(hObject, eventdata, handles)
% hObject handle to Lc1 (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
function Lc2_Callback(hObject, eventdata, handles)
% hObject handle to Lc2 (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 Lc2 as text
% str2double(get(hObject,'String')) returns contents of Lc2 as a double
% --- Executes during object creation, after setting all properties.
function Lc2_CreateFcn(hObject, eventdata, handles)
% hObject handle to Lc2 (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 MedFilter.
function MedFilter_Callback(hObject, eventdata, handles)
% hObject handle to MedFilter (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
run SurfInfo.m;
Lc = str2double(get(handles.Lc3,'String'));
Dx = Lc; %window function size in pixels
Dy = Lc; %window function size in pixels
Lext=round(Dx/2)+1;
S=[Lext,Lext];
Z=wextend('2D','sym',Z,Lext);% extension of edges
Z=medfilt2(Z,[Dx Dy]); % median filtering process
Z=Z(1+S(1):end-S(1),1+S(2):end-S(2));% remove padding (extension)
run PLot;
run FieldParameter.m;
run SurfUpdate.m;
guidata(hObject,handles)
function Lc3_Callback(hObject, eventdata, handles)
% hObject handle to Lc3 (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 Lc3 as text
% str2double(get(hObject,'String')) returns contents of Lc3 as a double
% --- Executes during object creation, after setting all properties.
function Lc3_CreateFcn(hObject, eventdata, handles)
% hObject handle to Lc3 (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 during object creation, after setting all properties.
function Sz_CreateFcn(hObject, eventdata, handles)
% hObject handle to Sz (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% --- Executes during object creation, after setting all properties.
function Sq_CreateFcn(hObject, eventdata, handles)
% hObject handle to Sq (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% --- Executes during object creation, after setting all properties.
function Ssk_CreateFcn(hObject, eventdata, handles)
% hObject handle to Ssk (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% --- Executes during object creation, after setting all properties.
function Sku_CreateFcn(hObject, eventdata, handles)
% hObject handle to Sku (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% --- Executes during object creation, after setting all properties.
function Sa_CreateFcn(hObject, eventdata, handles)
% hObject handle to Sa (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% --- Executes during object creation, after setting all properties.
function edit10_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit10 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% --- Executes on button press in OpenSurfBack.
function OpenSurfBack_Callback(hObject, eventdata, handles)
% hObject handle to OpenSurfBack (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
filterindex = handles.filterindex;
pathname = sprintf('%s',handles.pathname);
filename = sprintf('%s', handles.filename);
path = strcat(pathname, filename);
run OpenSurf.m;
run PLot.m;
run FieldParameter.m;
run SurfUpdate.m;
guidata(hObject,handles)
% --- Executes on button press in replot.
function replot_Callback(hObject, eventdata, handles)
% hObject handle to replot (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
run SurfInfo.m;
run PLot.m
function az_Callback(hObject, eventdata, handles)
% hObject handle to az (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 az as text
% str2double(get(hObject,'String')) returns contents of az as a double
% --- Executes during object creation, after setting all properties.
function az_CreateFcn(hObject, eventdata, handles)
% hObject handle to az (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
function el_Callback(hObject, eventdata, handles)
% hObject handle to el (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 el as text
% str2double(get(hObject,'String')) returns contents of el as a double
% --- Executes during object creation, after setting all properties.
function el_CreateFcn(hObject, eventdata, handles)
% hObject handle to el (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
function x_ar_Callback(hObject, eventdata, handles)
% hObject handle to x_ar (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 x_ar as text
% str2double(get(hObject,'String')) returns contents of x_ar as a double
% --- Executes during object creation, after setting all properties.
function x_ar_CreateFcn(hObject, eventdata, handles)
% hObject handle to x_ar (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
function y_ar_Callback(hObject, eventdata, handles)
% hObject handle to y_ar (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 y_ar as text
% str2double(get(hObject,'String')) returns contents of y_ar as a double
% --- Executes during object creation, after setting all properties.
function y_ar_CreateFcn(hObject, eventdata, handles)
% hObject handle to y_ar (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
function z_ar_Callback(hObject, eventdata, handles)
% hObject handle to z_ar (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 z_ar as text
% str2double(get(hObject,'String')) returns contents of z_ar as a double
% --- Executes during object creation, after setting all properties.
function z_ar_CreateFcn(hObject, eventdata, handles)
% hObject handle to z_ar (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 SaveSurface.
function SaveSurface_Callback(hObject, eventdata, handles)
% hObject handle to SaveSurface (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
z0 = (handles.Z)/1000000;
dx = double(handles.dx)/1000000;
dy = double(handles.dy)/1000000;
Mag = double(handles.Mag);
run SaveTData.m;
% --- Executes on button press in CropButton.
function CropButton_Callback(hObject, eventdata, handles)
% hObject handle to CropButton (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
run SurfInfo.m;
image(Z);
Z = imcrop;
image(Z);
[m, n]= size(Z);
xNum = n;
yNum = m;
run FieldParameter.m;
run SurfUpdate.m;
guidata(hObject,handles)
% --- Executes on button press in RotateButton.
function RotateButton_Callback(hObject, eventdata, handles)
% hObject handle to RotateButton (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
run SurfInfo.m;
angle = str2double(get(handles.RotateAngle,'String'));
Z = imrotate(Z, 180);
[m, n]= size(Z);
xNum = n;
yNum = m;
run PLot.m;
run FieldParameter.m;
run SurfUpdate.m;
guidata(hObject,handles);
function RotateAngle_Callback(hObject, eventdata, handles)
% hObject handle to RotateAngle (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 RotateAngle as text
% str2double(get(hObject,'String')) returns contents of RotateAngle as a double
% --- Executes during object creation, after setting all properties.
function RotateAngle_CreateFcn(hObject, eventdata, handles)
% hObject handle to RotateAngle (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 reverse_button.
function reverse_button_Callback(hObject, eventdata, handles)
% hObject handle to reverse_button (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
run SurfInfo.m;
Z = -Z;
run PLot.m;
run FieldParameter.m;
run SurfUpdate.m;
guidata(hObject,handles)
% --- Executes on button press in FlipY.
function FlipY_Callback(hObject, eventdata, handles)
% hObject handle to FlipY (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
run SurfInfo.m;
Z = flipud(Z);
run PLot.m;
run FieldParameter.m;
run SurfUpdate.m;
guidata(hObject,handles)
% --- Executes on button press in FlipX.
function FlipX_Callback(hObject, eventdata, handles)
% hObject handle to FlipX (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
run SurfInfo.m;
Z = fliplr(Z);
run PLot.m;
run FieldParameter.m;
run SurfUpdate.m;
guidata(hObject,handles)
% --- Executes on button press in re_size.
function re_size_Callback(hObject, eventdata, handles)
% hObject handle to re_size (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
run SurfInfo.m;
a = str2double(get(handles.re_size_ratio,'String'));
Z = imresize(Z,a,'nearest');
[m, n]= size(Z);
xNum = n;
yNum = m;
dx = dx/a;
dy = dy/a;
run PLot.m;
run FieldParameter.m;
run SurfUpdate.m;
guidata(hObject,handles)
function re_size_ratio_Callback(hObject, eventdata, handles)
% hObject handle to re_size_ratio (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 re_size_ratio as text
% str2double(get(hObject,'String')) returns contents of re_size_ratio as a double
% --- Executes during object creation, after setting all properties.
function re_size_ratio_CreateFcn(hObject, eventdata, handles)
% hObject handle to re_size_ratio (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 OutlierCorrection.
function OutlierCorrection_Callback(hObject, eventdata, handles)
% hObject handle to OutlierCorrection (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
run SurfInfo.m;
SD = str2double(get(handles.OutlierLevel,'String'));
w = str2double(get(handles.OutlierPixel,'String'));
run YOutlier.m;
%Z = inpaint_nans(Z,5);
run PLot.m;
run FieldParameter.m;
run SurfUpdate.m;
guidata(hObject,handles)
function OutlierLevel_Callback(hObject, eventdata, handles)
% hObject handle to OutlierLevel (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 OutlierLevel as text
% str2double(get(hObject,'String')) returns contents of OutlierLevel as a double
% --- Executes during object creation, after setting all properties.
function OutlierLevel_CreateFcn(hObject, eventdata, handles)
% hObject handle to OutlierLevel (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
function OutlierPixel_Callback(hObject, eventdata, handles)
% hObject handle to OutlierPixel (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 OutlierPixel as text
% str2double(get(hObject,'String')) returns contents of OutlierPixel as a double
% --- Executes during object creation, after setting all properties.
function OutlierPixel_CreateFcn(hObject, eventdata, handles)
% hObject handle to OutlierPixel (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 pushbutton20.
function pushbutton20_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton20 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
run SurfInfo.m;
Z = inpaint_nans(Z,5);
run PLot.m;
run FieldParameter.m;
run SurfUpdate.m;
guidata(hObject,handles)
% --------------------------------------------------------------------
function Untitled_1_Callback(hObject, eventdata, handles)
% hObject handle to Untitled_1 (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 ThresholdBtn.
function ThresholdBtn_Callback(hObject, eventdata, handles)
% hObject handle to ThresholdBtn (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
run SurfInfo.m;
T = str2double(get(handles.ThresholdV,'String'));
Z(Z>=T) = NaN;
run PLot.m;
run FieldParameter.m;
run SurfUpdate.m;
guidata(hObject,handles)
function ThresholdV_Callback(hObject, eventdata, handles)
% hObject handle to ThresholdV (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 ThresholdV as text
% str2double(get(hObject,'String')) returns contents of ThresholdV as a double
% --- Executes during object creation, after setting all properties.
function ThresholdV_CreateFcn(hObject, eventdata, handles)
% hObject handle to ThresholdV (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 RepNanArea.
function RepNanArea_Callback(hObject, eventdata, handles)
% hObject handle to RepNanArea (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
run SurfInfo.m;
NanArea = str2double(get(handles.NanArea,'String'));
B = Z;
B(isnan(B)) = min(B(:)) -50;
T = min(B(:)) +10;
BW = imbinarize(B, T);
BW = -BW+1;
%LowBW = min(BW(:));
%BW(BW==LowBW) = 0;
BW = ~bwareaopen(BW, NanArea);
Z(BW==0) = min(Z(:))-50;
Z = inpaint_nans(Z,3);
Z(BW==0) = NaN;
run PLot.m;
run FieldParameter.m;
run SurfUpdate.m;
guidata(hObject,handles)
function NanArea_Callback(hObject, eventdata, handles)
% hObject handle to NanArea (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 NanArea as text
% str2double(get(hObject,'String')) returns contents of NanArea as a double
% --- Executes during object creation, after setting all properties.
function NanArea_CreateFcn(hObject, eventdata, handles)
% hObject handle to NanArea (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 CropXY.
function CropXY_Callback(hObject, eventdata, handles)
% hObject handle to CropXY (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
run SurfInfo.m;
X1 = str2double(get(handles.CropX1,'String'));
Y1 = str2double(get(handles.CropX2,'String'));
W1 = str2double(get(handles.CropY1,'String'));
H1 = str2double(get(handles.CropY2,'String'));
%image(Z);
Z = imcrop(Z,[X1 Y1 W1 H1]); % X Y Width Height
image(Z);
[m, n]= size(Z);
xNum = n;
yNum = m;
run FieldParameter.m;
run SurfUpdate.m;
run PLot.m;
guidata(hObject,handles)
function CropX1_Callback(hObject, eventdata, handles)
% hObject handle to CropX1 (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 CropX1 as text
% str2double(get(hObject,'String')) returns contents of CropX1 as a double
% --- Executes during object creation, after setting all properties.
function CropX1_CreateFcn(hObject, eventdata, handles)
% hObject handle to CropX1 (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
function CropX2_Callback(hObject, eventdata, handles)
% hObject handle to CropX2 (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 CropX2 as text
% str2double(get(hObject,'String')) returns contents of CropX2 as a double
% --- Executes during object creation, after setting all properties.
function CropX2_CreateFcn(hObject, eventdata, handles)
% hObject handle to CropX2 (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
function CropY1_Callback(hObject, eventdata, handles)
% hObject handle to CropY1 (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 CropY1 as text
% str2double(get(hObject,'String')) returns contents of CropY1 as a double
% --- Executes during object creation, after setting all properties.
function CropY1_CreateFcn(hObject, eventdata, handles)
% hObject handle to CropY1 (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
function CropY2_Callback(hObject, eventdata, handles)
% hObject handle to CropY2 (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 CropY2 as text
% str2double(get(hObject,'String')) returns contents of CropY2 as a double
% --- Executes during object creation, after setting all properties.
function CropY2_CreateFcn(hObject, eventdata, handles)
% hObject handle to CropY2 (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
% --------------------------------------------------------------------
function uipushtool2_ClickedCallback(hObject, eventdata, handles)
% hObject handle to uipushtool2 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
%run PLot.m;
F = getframe(handles.axes1);
Image = frame2im(F);
[filename, pathname] = uiputfile(...
{'*.jpg';'*.*'},...
'Save Image Data as');
if filename == 0
% User clicked the Cancel button.
return;
end
path = [pathname filename];
imwrite(Image, path);
% --- Executes during object creation, after setting all properties.
function axes1_CreateFcn(hObject, eventdata, handles)
% hObject handle to axes1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: place code in OpeningFcn to populate axes1
this is the error promt out after I try to run the GUI
Unrecognized function or variable 'RotateButton_CreateFcn'.
Error in gui_mainfcn (line 95)
feval(varargin{:});
Error in SurfSuite2 (line 42)
gui_mainfcn(gui_State, varargin{:});
Error inmatlab.graphics.internal.figfile.FigFile/read>@(hObject,eventdata)SurfSuite2('RotateButton_CreateFcn',hObject,eventdata,guidata(hObject))
  1 个评论
Geoff Hayes
Geoff Hayes 2020-5-21
Aina - it looks like your RotateButton_CreateFcn function has been removed from the GUI. You could try adding
% --- Executes during object creation, after setting all properties.
function RotateButton_CreateFcn(hObject, eventdata, handles)
% hObject handle to pushbutton1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
and that "may" fix the problem. If it isn't needed, then you could try to remove it via the property inspector of the button.

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Graphics Object Properties 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by