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

📄 stripimageproc2c.m

📁 A graphical user interface designed to control a confocal microscope.
💻 M
字号:
function StripImageProc(Obj,Event,Hi,InpFs,RaisT,FallT,NumbLines,NumbPixels,NumbStrip,NumbSequ,Kalman,Channel)
% StripImageProc2C process the data coming form the NI-ADQ board. This function removes the data 
% adquiered along the fly-back, perform integration (low-pass filter) and reshape the data 
% in an array. Use the "image" function to plot the data. 
% Use this function when the two channels are avialable.
%
% Input Arguments: 
% Obj: handle to Analog Input Object
% Event: event data (not used in this function)
% Hi: handle of the current Image
% InpFs: Input Sample Frequency (Hz)
% RaisT: Raising Part of the Ramp (s)
% FallT: Falling Part of the Ramp (s)
% NumbLines: Number of Lines per Image
% NumbPixsels: Number of Pixels per Line
% NumbStrip: Number of Strip per Image
% NumbSequ: Number of Images scanned
% Kalman: if 1 the filter is "off", if any integer larger than 1 it is "on" 
% Channel:channels which are ON: 1=Ch1, 2=Ch2, 3=Ch1-Ch2
%
% Output Arguments:
%
% Usage:
% StripImageProc(Obj,Event,Hi,InpFs,RaisT,FallT,NumbLines,NumbPixels,NumbStrip,NumbSequ,Kalman,Channel);


% Points in the Raising Part of the X Scanning 
% RaisP= InpFs*RaisT;
% Points in the Falling Part of the X Scanning
% FallP= InpFs*FallT;
% Use Factor or porcentage of used data
UseF=1/1.328125;   % approx .75
% Integration Number or Bin Factor
BinF= round(UseF*InpFs*RaisT/NumbPixels);
% Number of Lines in one Strip
Strip= round(NumbLines/NumbStrip);
% Total number of data adquired per strip of the Image
Samples= round(InpFs*(RaisT+FallT)*Strip);
% Figure, Axes and Image handles
Ha=get(Hi,'Parent');
Hf=get(Ha,'Parent');
% Get image Index and update it
Index= get(Hi,'UserData');
set(Hi,'UserData',Index+1);
% Position of present Strip in the whole Image
IndexPosit= rem(Index,NumbStrip);
% Position of present Image in the whole Sequence
IndexSequ= (floor(Index/(NumbStrip*Kalman)) +1)*(NumbSequ~=1) + (NumbSequ==1) ;
% Kalman Index
N= int16(rem( floor(Index/NumbStrip) , Kalman ) +1) ;
N1=N-int16(1);
% Read data
Data=getdata(Obj,Samples,'native');

% Reshape the array: each column is a horizontal line of the image
Data= reshape(Data,Samples/Strip,2*Strip);
% Remove the data adquiered during the fly-back of Mirror X 
Data= Data([1:round(UseF*InpFs*RaisT)]+round(.5*(1-UseF)*InpFs*RaisT),:);
% Reshape again to perform the integration
Data= reshape(Data,BinF,NumbPixels*2*Strip);
Data= sum(Data,1,'native')'+ int16(2048);
% Final reshape:
% each array row is an horizontal line of the image
% each array column is an vertical line of the image
Data= reshape(Data,NumbPixels,2*Strip)';
Data= [ Data(1:Strip,:)*int16(Channel~=2), Data(1+Strip:2*Strip,:)*int16(Channel~=1)];

% Send the formatted data to the open image
C=get(Hf,'UserData');
C(IndexSequ).Slide(IndexPosit*Strip+1:(IndexPosit+1)*Strip, : )= ((N-1)*C(IndexSequ).Slide(IndexPosit*Strip+1:(IndexPosit+1)*Strip, : )+Data)/N *int16(Kalman~=1) + ...
                                                                  Data*int16(Kalman==1) ;
set(Hf,'UserData',C);
set(Hi,'CData',C(IndexSequ).Slide/int16(16));

⌨️ 快捷键说明

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