GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • FAST | Documentation
  • Get started
  • Install FAST
  • C++ Introduction Tutorial
  • Python Introduction Tutorial
  • Text Pipelines
  • Learn FAST
  • C++ Tutorials
  • C++ Examples
  • Python Tutorials
  • Python Examples
  • API Reference
  • API Index
  • Building FAST

This view

  • Original page
  • New address

GeezerVison is showing fast-imaging.github.io — display_ultrasound_file_format_data_with_matplotlib.py source | FAST | Documentation

display_ultrasound_file_format_data_with_matplotlib.py source

This example will stream ultrasound images from an ultrasound file format (UFF) file, and display consecutive frames in a 2x2 matplotlib subplot.

This example will stream ultrasound images from an ultrasound file format (UFF) file, and display consecutive frames in a 2x2 matplotlib subplot

Image
import fast
import matplotlib.pyplot as plt
import numpy as np

streamer = fast.UFFStreamer.create(
    fast.Config.getTestDataPath() + 'US/UFF/P4_2_A4C.uff',
    gain=0,
    dynamicRange=60,
    #doScanConversion=False # Set to False to get images in beamspace
    #framerate=5,
)

# Create a 2x2 subplot for every set of 4 image frames
image_list = []
for image in fast.DataStream(streamer):
    image_list.append(np.asarray(image))
    if len(image_list) == 4:
        # Display the 4 last images
        f, axes = plt.subplots(2, 2, figsize=(10,10))
        for i in range(2):
            for j in range(2):
                axes[i, j].imshow(image_list[i + j*2][..., 0], cmap='gray')
        plt.show()
        image_list.clear()
        break # Stop loop
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.