Matlab Ulterius

From WikiSonix
Jump to: navigation, search

In order to provide the researchers with the ability to control the Ultrasonix systems from the Matlab environment, we have developed the Matlab Ulterius 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 Ulterius SDK.


Matlab Ulterius SDK


UlteriusCOMServer BD.jpg

The SDK contains sample scripts which shows its basic functions.

The following steps are taken in each sample scripts:

  • The UlteriusCOM 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 UlteriusCOM.dll as a COM server on the machine, which allows Matlab to connect to it.
% SDK path to find the UlteriusCOM server
SDK_BIN_PATH = '../../bin';

% Registering the UlteriusCOM server on the computer
system(['cd "' SDK_BIN_PATH '" && ' 'regsvr32 UlteriusCOM.dll']);
  • Matlab connects to the UlteriusCOM.Server as a client and gets a handle to the server.
h = actxserver('UlteriusCOM.Server');
  • The server then provides all the functions that Ulterius SDK provides in the C++ environment, to the user in the Matlab environment, via the handle. For example to connect to a Sonix system:
h.connect(SONIX_IP);
  • Moreover, the frame and parameter callback feature of the Ulterius 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 Ulterius Matlab SDK.
% registering the callbacks
h.registerevent({'newFrameEvent' 'dataCallback'});
h.registerevent({'paramEvent' 'paramCallback'});
  • 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 UlteriusCOM.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.

>>methods(h)

Methods for class COM.UlteriusCOM_Server:

addproperty                 
connect                     
constructorargs             
decParam                    
delete                      
deleteproperty              
disconnect                  
events                      
get                         
getActiveImagingMode        
getActivePreset             
getActiveProbe              
getCineData                 
getCineDataCount            
getCompressionStatus        
getDataDescriptor           
getDataToAcquire            
getFreezeState              
getInjectMode               
getLastError                
getMaxCineFrames            
getParam                    
getParamValue               
getPatientInfo              
getPresets                  
getProbes                   
getSharedMemoryStatus       
getStreamStatus             
getdataRateReductionFactor  
incParam                    
injectImage                 
interfaces                  
invoke                      
isConnected                 
isDataAvailable             
load                        
move                        
propedit                    
release                     
save                        
saveScreenImage             
selectMode                  
selectPreset                
selectProbe                 
send                        
set                         
setCompressionStatus        
setDataToAcquire            
setInjectMode               
setMessaging                
setParamValue               
setSharedMemoryStatus       
setTimeout                  
setdataRateReductionFactor  
stopStream                  
streamScreen                
testCallback                
testParamCallback           
toggleFreeze