⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 configurationgui.m

📁 A graphical user interface designed to control a confocal microscope.
💻 M
📖 第 1 页 / 共 2 页
字号:
guidata(hObject, handles);
% Update Input Frequency
InpFs_Callback(handles.InpFs, eventdata, handles);


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% --- Executes during object creation, after setting all properties.
function RaisT_CreateFcn(hObject, eventdata, handles)
% hObject    handle to RaisT (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: popupmenu controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc
    set(hObject,'BackgroundColor','white');
else
    set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));
end


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% --- Executes on selection change in RaisT.
function RaisT_Callback(hObject, eventdata, handles)
% hObject    handle to RaisT (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
% Hints: contents = get(hObject,'String') returns RaisT contents as cell array
%        contents{get(hObject,'Value')} returns selected item from RaisT
Val = get(hObject,'Value');
handles.ValRaisT = (Val==1)*1.7e-3 + (Val==2)*3.4e-3 ;
% Update handles structure
guidata(hObject, handles);
% Update Input Frequency
InpFs_Callback(handles.InpFs, eventdata, handles);


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% --- Executes during object creation, after setting all properties.
function MaxValue_CreateFcn(hObject, eventdata, handles)
% hObject    handle to MaxValue (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: popupmenu controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc
    set(hObject,'BackgroundColor','white');
else
    set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));
end


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% --- Executes on selection change in MaxValue.
function MaxValue_Callback(hObject, eventdata, handles)
% hObject    handle to MaxValue (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
% Hints: contents = get(hObject,'String') returns MaxValue contents as cell array
%        contents{get(hObject,'Value')} returns selected item from MaxValue
Val = get(hObject,'Value');
handles.ValMaxValue = 2^(Val-1)*100;
% Update handles structure
guidata(hObject, handles);


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% --- Executes during object creation, after setting all properties.
function KalmanMem_CreateFcn(hObject, eventdata, handles)
% hObject    handle to KalmanMem (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
    set(hObject,'BackgroundColor','white');
else
    set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));
end


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function KalmanMem_Callback(hObject, eventdata, handles)
% hObject    handle to KalmanMem (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 KalmanMem as text
%        str2double(get(hObject,'String')) returns contents of KalmanMem as a double
KalmanM = round(str2double(get(hObject,'String')));
if (KalmanM<2) | isnan(KalmanM)
    KalmanM=2;
end    
handles.ValKalmanMem=KalmanM;
set(hObject,'String',sprintf('%d',handles.ValKalmanMem))
% Update handles structure
guidata(hObject, handles);


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% --- Executes during object creation, after setting all properties.
function NumbSequ_CreateFcn(hObject, eventdata, handles)
% hObject    handle to NumbSequ (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
    set(hObject,'BackgroundColor','white');
else
    set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));
end


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function NumbSequ_Callback(hObject, eventdata, handles)
% hObject    handle to NumbSequ (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 NumbSequ as text
%        str2double(get(hObject,'String')) returns contents of NumbSequ as a double
NumbSequ = round(str2double(get(hObject,'String')));
if (NumbSequ<2) | isnan(NumbSequ)
    NumbSequ=2;
end    
handles.ValNumbSequ=NumbSequ;
set(hObject,'String',sprintf('%d',handles.ValNumbSequ))
% Update handles structure
guidata(hObject, handles);


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% --- Executes during object creation, after setting all properties.
function Step_CreateFcn(hObject, eventdata, handles)
% hObject    handle to Step (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
    set(hObject,'BackgroundColor','white');
else
    set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));
end


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function Step_Callback(hObject, eventdata, handles)
% hObject    handle to Step (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 Step as text
%        str2double(get(hObject,'String')) returns contents of Step as a double
Step = str2double(get(hObject,'String'));
if isnan(Step)
    Step=1;
end
handles.ValStep=round(Step*10)/10;
set(hObject,'String',sprintf('%.1f',handles.ValStep))
% Update handles structure
guidata(hObject, handles);


% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% % --- Executes during object creation, after setting all properties.
% function Alpha_CreateFcn(hObject, eventdata, handles)
% % hObject    handle to Alpha (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
%     set(hObject,'BackgroundColor','white');
% else
%     set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));
% end
% 
% 
% 
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% function Alpha_Callback(hObject, eventdata, handles)
% % hObject    handle to Alpha (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 Alpha as text
% %        str2double(get(hObject,'String')) returns contents of Alpha as a double
% Alpha = round(10*str2double(get(hObject,'String')))/10;
% if abs(Alpha)<20
%     handles.ValAlpha=Alpha;
% else
%     handles.ValAlpha=0;
%     set(hObject,'String',num2str('0'));
% end    
% % Update handles structure
% guidata(hObject, handles);


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% --- Executes on button press in Update.
function Update_Callback(hObject, eventdata, handles)
% hObject    handle to Update (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 Update

% Load parameters from the Main window
Main_handles=guidata(handles.Main);
OldMaxValue=Main_handles.MaxValue;
% Update parameters 
Main_handles.NumbPixels = handles.ValNumbPixels;  
Main_handles.NumbLines = handles.ValNumbLines;   
Main_handles.InpFs = handles.ValInpFs*1000;
Main_handles.BinF = handles.ValBinF;   
Main_handles.RaisT = handles.ValRaisT;   
Main_handles.FallT= 0.3e-3*(handles.ValRaisT==1.7e-3) + 0.6e-3*(handles.ValRaisT==3.4e-3);
Main_handles.MaxValue = handles.ValMaxValue; 
Main_handles.KalmanMem = handles.ValKalmanMem;    
Main_handles.Kalman= handles.ValKalmanMem*(Main_handles.Kalman~=1) + 1*(Main_handles.Kalman==1);
Main_handles.NumbSequ = handles.ValNumbSequ;   
Main_handles.Step = handles.ValStep;  
if OldMaxValue~=handles.ValMaxValue
    % Reset Offset
    Main_handles.OffSet=[160.5,120.5];
    % Reset RedBoxes and RedCrosses
    set([Main_handles.RedBox1 Main_handles.RedBox2 Main_handles.RedCross1 Main_handles.RedCross2],'Visible','off')
end
% Update Stage GUI
try
	Stage_handles=guidata(Main_handles.HStageCTL);
	set(Stage_handles.Step,'String',sprintf('%.1f',handles.ValStep));
	Stage_handles.ValStep=handles.ValStep;
    guidata(Main_handles.HStageCTL,Stage_handles);
end
% Save parameters to the Main window 
guidata(handles.Main,Main_handles);

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -