Example: Processing Recorded Ultrasound Channel Data
This example shows how to:
Load a recorded ultrasound channel data file
Process the data to a B-mode image
How to use some of the parameters of the processing functions
import imfusion as imf
import imfusion.ultrasound_image_formation as usi
import numpy as np
import matplotlib.pyplot as plt
# Load recorded RF ultrasound channel data from an imfusion file
[rf_channel_data] = imf.load("simus_logo.imf")
# Process the RF channel data using the USImageFormation Plugin
filtered = usi.filter_channel_data(rf_channel_data)
iqdemod = usi.iq_demodulation(filtered)
beamformed = usi.beamforming(iqdemod)
envelope = usi.envelope_detection(beamformed, reference_amplitude=100000.0, dynamic_range=45.0)
scanconverted = imf.execute_algorithm('USExp.ScanConversion2', [envelope])[0]
# Get 2D numpy array from the scanconverted data
scanconverted = np.array(scanconverted)[0, ..., 0]
# Display the B-mode image
plt.figure(figsize=(10, 10))
plt.imshow(scanconverted[180:330], cmap='gray')
plt.title("B-mode Image")
plt.axis('off')
plt.show()