Reading CPWC data from an UFF file recorded from an Alpinion scanner

In this example we show how to read channel and beamformed data from a UFF (Ultrasound File Format) file recorded with an Alpinion scanner. You will need an internet connection to download data.

by Ole Marius Hoel Rindal and Muyinatu Lediju Bell 27.05.2017


Checking the file is in the path

To read data from a UFF file the first we need is, you guessed it, a UFF file. We check if it is on the current path and download it from the USTB websever.

clear all; close all;
% data location
url='';      % if not found downloaded from here
local_path = [ustb_path(),'/data/']; % location of example data

% We have to different Alpinion CPWC datasets, comment out the one to use

% check if the file is available in the local path & downloads otherwise, url, local_path);
Downloading This may take a while.

Reading channel data

Now that the file is on the path let us create a UFF object to interact with the file. We open it in "append" mode.

uff_file = 

  uff with properties:

    filename: 'Alpinion_L3-8_CPWC_hyperechoic_scatterers.uff'
     version: 'v1.0.1'
        mode: 'append'
     verbose: 1

Let's first check if we are lucky and the file allready contains beamformed_data that we can display.

content = uff_file.index('/',display);

has_b_data = false;
for i = 1:length(content)
    if strcmp(content{i}.class,'uff.beamformed_data')
        has_b_data = true; % We found a beamformed data object!
UFF: Contents of Alpinion_L3-8_CPWC_hyperechoic_scatterers.uff at /
   - /channel_data: channel_data [uff.channel_data] size(1,1)

If the file had beamformed data, let's read that and the channeldata, before we can jump straight to displaying the data since it's allready beamformed

if has_b_data'/b_data');'/channel_data');

If it doesn't have any beamformed data at least it should have some channel_data. So let's read that.'/channel_data');
UFF: reading channel_data [uff.channel_data]
UFF: reading sequence [uff.wave]
Processed 21/21

And then do the normal routine of defining the scan,

    sca.x_axis = linspace(channel_data.probe.x(1),channel_data.probe.x(end),512).';
    sca.z_axis = linspace(1e-3,50e-3,512).';

setting up and running the beamforming



    b_data=bmf.go({process.das_mex process.coherent_compounding});

Now we can save this beamformed image to that file, so that we don't have to wait for the beamforming next time.

UFF: writting b_data [uff.beamformed_data] at 

Display image

And finally display the image.

b_data.plot([],strrep(filename,'_',' '));

Write info about channel data

Let's look at the info given about this dataset

Name: 		 CPWC dataset of hyperechoic cyst and points  
		 scatterers recorded on an Alpinion scanner with a  
		 L3-8 Probe from a CIRC General Purpose Ultrasound  
Author(s): 	 Ole Marius Hoel Rindal <> 
		 Muyinatu Lediju Bell <> 
Version: 	 1.0.1