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

📄 imagewindow.m

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

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

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

% Begin initialization code - DO NOT EDIT
gui_Singleton = 0;
gui_State = struct('gui_Name',       mfilename, ...
                   'gui_Singleton',  gui_Singleton, ...
                   'gui_OpeningFcn', @ImageWindow_OpeningFcn, ...
                   'gui_OutputFcn',  @ImageWindow_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 ImageWindow is made visible.
function ImageWindow_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 ImageWindow (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));
CM=get(Main_handles.ScanGUI,'ColorMap');
set(hObject,'DoubleBuffer','on','Interruptible','off','UserData',repmat(struct('Slide',repmat(int16(0),[HeightIm,WidthIm])),1,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);
handles.Hi=image(repmat(int16(0),[HeightIm,WidthIm]),'CDataMapping','direct','EraseMode','normal','UserData',0);

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

% Update handles structure
guidata(hObject, handles);

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


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% --- Outputs from this function are returned to the command line.
function varargout = ImageWindow_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;


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
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.Slide),[PathName FileName],'tif','Compression','none','WriteMode','overwrite');
elseif FileName~=0 & Ind==2
    Data=get(handles.output,'UserData');
    imwrite( uint8(Data.Slide/int16(16) ),[PathName FileName],'tif','Compression','none','WriteMode','overwrite');
end    



%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% --- Executes when user attempts to close ImageWindow.
function ImageWindow_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 ImageWindow (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
    try delete(hObject); end
end


⌨️ 快捷键说明

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