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

📄 sequencewindow.m

📁 A graphical user interface designed to control a confocal microscope.
💻 M
字号:
function varargout = SequenceWindow(varargin)
% This GUI is opened to display the data acquired by a Sequence process. 

% SEQUENCEWINDOW M-file for SequenceWindow.fig
%      SEQUENCEWINDOW, by itself, creates a new SEQUENCEWINDOW or raises the existing
%      singleton*.
%
%      H = SEQUENCEWINDOW returns the handle to a new SEQUENCEWINDOW or the handle to
%      the existing singleton*.
%
%      SEQUENCEWINDOW('CALLBACK',hObject,eventData,handles,...) calls the local
%      function named CALLBACK in SEQUENCEWINDOW.M with the given input arguments.
%
%      SEQUENCEWINDOW('Property','Value',...) creates a new SEQUENCEWINDOW or raises the
%      existing singleton*.  Starting from the left, property value pairs are
%      applied to the GUI before SequenceWindow_OpeningFunction gets called.  An
%      unrecognized property name or invalid value makes property application
%      stop.  All inputs are passed to SequenceWindow_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 SequenceWindow

% Last Modified by GUIDE v2.5 17-Aug-2004 10:51:13

% Begin initialization code - DO NOT EDIT
gui_Singleton = 0;
gui_State = struct('gui_Name',       mfilename, ...
                   'gui_Singleton',  gui_Singleton, ...
                   'gui_OpeningFcn', @SequenceWindow_OpeningFcn, ...
                   'gui_OutputFcn',  @SequenceWindow_OutputFcn, ...
                   'gui_LayoutFcn',  [] , ...
                   'gui_Callback',   []);
if nargin & isstr(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 SequenceWindow is made visible.
function SequenceWindow_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 SequenceWindow (see VARARGIN)

% Choose default command line output for ImageWindow
handles.output = hObject;

% Read intput variable: 
% Handle of the Main window
% Load parameters from the Main window
Main_handles=guidata(varargin{1});
NameFig=varargin{2};

% Setting the window
HeightIm=Main_handles.NumbLines;
WidthIm=Main_handles.NumbPixels*(1+(Main_handles.Channel==3));
NumbSequ=Main_handles.NumbSequ;
CM=get(Main_handles.ScanGUI,'ColorMap');
set(hObject,'DoubleBuffer','on','Interruptible','off','UserData',repmat(struct('Slide',repmat(int16(0),[HeightIm,WidthIm])),NumbSequ,1), ...
            'Position',[Main_handles.LocDatGUI WidthIm+100 HeightIm+100],'Name',NameFig,'ColorMap',CM);
set(handles.ImageAxes,'Position',[50 50 WidthIm HeightIm],'XLim',[1 WidthIm],'YLim',[1 HeightIm],'XTick',[100:100:WidthIm],'YTick',[100:100:HeightIm],'FontSize',8);
% Setup the axes-image
handles.Hi=image(repmat(int16(0),[HeightIm,WidthIm]),'CDataMapping','direct','EraseMode','normal','UserData',0);
% Setup the slider
set(handles.ImageSlider,'Position',[50 50+HeightIm WidthIm 20],'min',1,'max',NumbSequ,'Value',NumbSequ,'SliderStep',[1 1]/(NumbSequ-1));
handles.NumbSequ=NumbSequ;

% Handle to the Input Data Process
handles.AI=Main_handles.AI;

% Update handles structure
guidata(hObject, handles);

% UIWAIT makes SequenceWindow wait for user response (see UIRESUME)
% uiwait(handles.figure1);


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% --- Outputs from this function are returned to the command line.
function varargout = SequenceWindow_OutputFcn(hObject, eventdata, handles)
% The outputs are the handles for the GUI figure and image.

% 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;
varargout{2} = handles.Hi;


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% --- Executes during object creation, after setting all properties.
function ImageSlider_CreateFcn(hObject, eventdata, handles)
% hObject    handle to ImageSlider (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, change
%       'usewhitebg' to 0 to use default.  See ISPC and COMPUTER.
usewhitebg = 1;
if usewhitebg
    set(hObject,'BackgroundColor',[.9 .9 .9]);
else
    set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));
end


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% --- Executes on slider movement.
function ImageSlider_Callback(hObject, eventdata, handles)
% Each time the slider is pressed, this function show a new image form the
% sequence.

% hObject    handle to ImageSlider (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,'Value') returns position of slider
%        get(hObject,'Min') and get(hObject,'Max') to determine range of slider
Index=round(get(hObject,'Value'));
Data=get(handles.output,'UserData');
set(handles.Hi,'CData',Data(Index).Slide/int16(16));

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function SaveFile_Callback(hObject, eventdata, handles)
% Save data to a TIF file.

% hObject    handle to SaveFile (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
FileName=strrep(get(handles.output,'Name'),' ','');
[FileName,PathName,Ind] = uiputfile({'*.tif;*.tiff','16 bits - tif';'*.tif;*.tiff','8 bits - tif'},'Save Image As',[FileName '.tif']);
if FileName~=0 & Ind==1
    Data=get(handles.output,'UserData');
    imwrite(uint16(Data(1).Slide),[PathName FileName],'tif','Compression','none','WriteMode','overwrite');
    for ii=2:handles.NumbSequ
       imwrite(uint16(Data(ii).Slide),[PathName FileName],'tif','Compression','none','WriteMode','append');
    end    
elseif FileName~=0 & Ind==2
    Data=get(handles.output,'UserData');
    imwrite(uint8(Data(1).Slide/int16(16)),[PathName FileName],'tif','Compression','none','WriteMode','overwrite');
    for ii=2:handles.NumbSequ
       imwrite(uint8(Data(ii).Slide/int16(16)),[PathName FileName],'tif','Compression','none','WriteMode','append');
    end    
end    



%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% --- Executes when user attempts to close SequenceWindow.
function SequenceWindow_CloseRequestFcn(hObject, eventdata, handles)
% Before closing the window, check that the process is not running. If it is, 
% then show an Alert message asking the user to stop the acquisitoin process
% before closingg the window.

% hObject    handle to SequenceWindow (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hint: delete(hObject) closes the figure
if strcmp(get(handles.AI,'Running'),'On')
     P=get(handles.output,'Position');
     AlertGUI('Position',[P(1)+P(3)/2-100,P(2)+P(4)/2-37,200,75]);
else
   delete(hObject);
end


⌨️ 快捷键说明

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