Matlab Texo

From WikiSonix
Jump to: navigation, search

In order to provide the researchers with the ability to control the Ultrasonix systems at the sequencer level, from the Matlab environment, we have developed the Matlab Texo SDK. The most important feature of the SDK is the ability to acquire live images in the Matlab environment in real-time. Matlab has the ability to connect to COM servers, and receive events from them in real-time. This feature is used in the Matlab Texo SDK.

Matlab Texo SDK
TexoCOMServer BD.jpg

The SDK contains sample scripts which shows its basic functions.

The following steps are taken in each sample scripts:

  • the TexoCOM server is registered in the windows. This operation can be done either from within the Matlab environment or from the command prompt of Windows. It is essentially a Windows system operation. It registers and starts the TexoCOM.dll as a COM server on the machine, which allows Matlab to connect to it.
% SDK path to find the TexoCOM server
SDK_BIN_PATH = '../../bin';

% Registering the TexoCOM server on the computer
system(['cd "' SDK_BIN_PATH '" && ' 'regsvr32 TexoCOM.dll']);
  • Matlab connects to the TexoCOM.Server as a client and gets a handle to the server.
h = actxserver('TexoCOM.Server');
  • The server then provides all the functions that Texo SDK provides in the C++ environment, to the user in the Matlab environment, via the handle. For example to activate probe connector 0:
h.texoActivateProbeConnector(0);
  • Moreover, the frame callback feature of the Texo SDK is provided via events that propagate to the Matlab client from the COM server. You can register a Matlab function to these events. The function (which you write) will essentially do the same thing as the callback functions do in the C++ environment, and provide real-time capabilities to the Texo Matlab SDK.
% registering the callback
h.registerevent({'newFrameEvent' 'yourFunctionName'});
  • Once done, the server can be shut down and unregistered from within the Matlab environment (or command prompt of Windows):
system(['cd "' SDK_BIN_PATH '" && ' 'regsvr32 /u TexoCOM.dll']);

A list of all the implemented methods, together with the default methods associated with COM servers can be obtained by typing methods(h) in the Matlab environment. The methods which start with texo are the Texo SDK function. The methods which start with texoRP_ set the properties of the receive parameter structure, and so forth. The reason that you need to call single functions for setting properties of the receive parameters, transmit paramters, etc is that Matlab does not support structures as one of the types that can be passed on to COM servers and back.

>> methods(h)

Methods for class COM.TexoCOM_Server:

addproperty                         
constructorargs                     
delete                              
deleteproperty                      
events                              
get                                 
getdataRateReductionFactor          
interfaces                          
invoke                              
load                                
move                                
propedit                            
release                             
save                                
send                                
set                                 
setdataRateReductionFactor          
texoActivateProbeConnector          
texoAddLine                         
texoAddReceive                      
texoAddTGC                          
texoAddTGCFixed                     
texoAddTransmit                     
texoBeginSequence                   
texoClearTGCs                       
texoCloseDelayReadBack              
texoEnableSyncNotify                
texoEndSequence                     
texoForceConnector                  
texoGetCine                         
texoGetCollectedFrameCount          
texoGetFrameRate                    
texoGetFrameSize                    
texoGetMaxFrameCount                
texoGetProbeCenterFreq              
texoGetProbeCode                    
texoGetProbeFOV                     
texoGetProbeHasMotor                
texoGetProbeName                    
texoGetProbeNumElements             
texoGoToPosition                    
texoInit                            
texoIsImaging                       
texoIsInitialized                   
texoRP_setAcquisitionDepth          
texoRP_setAngle                     
texoRP_setAperture                  
texoRP_setApplyFocus                
texoRP_setCenterElement             
texoRP_setChannelMask               
texoRP_setCustomLineDuration        
texoRP_setDecimation                
texoRP_setLGCValue                  
texoRP_setManualDelays              
texoRP_setMaxApertureDepth          
texoRP_setNumChannels               
texoRP_setSaveDelay                 
texoRP_setSpeedOfSound              
texoRP_setTGCSel                    
texoRP_setTableIndex                
texoRP_setUseCustomWindow           
texoRP_setUseManualDelays           
texoRP_setWeightType                
texoRP_setWindow                    
texoRP_setrxAprCrv_btm              
texoRP_setrxAprCrv_mid              
texoRP_setrxAprCrv_top              
texoRP_setrxAprCrv_vmid             
texoRunImage                        
texoSelectProbe                     
texoSetDelayReadBack                
texoSetPower                        
texoSetSyncSignals                  
texoSetVCAInfo                      
texoSetupMotor                      
texoShutdown                        
texoStepMotor                       
texoStopImage                       
texoTGCCrv_setBtm                   
texoTGCCrv_setMid                   
texoTGCCrv_setTop                   
texoTGCCrv_setVmid                  
texoTP_setAngle                     
texoTP_setAperture                  
texoTP_setCenterElement             
texoTP_setFocusDistance             
texoTP_setFrequency                 
texoTP_setManualDelays              
texoTP_setMask                      
texoTP_setPulseShape                
texoTP_setSpeedOfSound              
texoTP_setSync                      
texoTP_setTableIndex                
texoTP_setUseManualDelays           
texoTP_setUseMask                   
texoTestCallback                    
texoVCAInfo_setActivetermination    
texoVCAInfo_setAmplification        
texoVCAInfo_setHPFDigitalEnable     
texoVCAInfo_setHPFDigitalValue      
texoVCAInfo_setInclamp              
texoVCAInfo_setLNAIntegratorEnable  
texoVCAInfo_setLPF                  
texoVCAInfo_setPGAIntegratorEnable