fast::UltrasoundImageCropper class

Automatic cropping of an ultrasound scanner image.

When streaming or storing images/video on ultrasound scanner, the menu and a lot of information around the actual ultrasound image is often included. This algorithm tries to extract the ultrasound image from the entire scanner GUI image using two thresholds. It does this by counting the number of non-zero pixels in every row and column of the image. To find the min x and max x positions, it starts from the middle and stops at the first x position which has a number of pixels equal to 0 above the thresholdVertical. It does this both in the left and right direction. Then this is repeated for the vertical direction, y using thresholdHorizontal. Works best on linear array images.

Inputs:

Outputs:

Base classes

class ProcessObject
Abstract base class for all process objects.

Public functions

auto create(float physicalWidth, bool staticCropping, float thresholdVertical, float thresholdHorizontal) -> std::shared_ptr<UltrasoundImageCropper>
Create instance.
void setStaticCropping(bool staticCropping)
void setThresholds(float threshold1, float threshold2)
void loadAttributes() override

Private functions

void execute() virtual

Function documentation

std::shared_ptr<UltrasoundImageCropper> fast::UltrasoundImageCropper::create(float physicalWidth, bool staticCropping, float thresholdVertical, float thresholdHorizontal)

Create instance.

Parameters
physicalWidth The physical width of the scanning region. This is used to set the pixel spacing correctly.
staticCropping Estimate the cropping parameters (offset, size) on the first frame only, then use these for all subsequent frames
thresholdVertical Number of pixels that have to be above 0 to accept an image column to be outside of ultrasound sector
thresholdHorizontal Number of pixels that have to be above 0 to accept an image row to be outside of ultrasound sector
Returns instance By setting the physical width of the image, the physical height can also be calculated and the spacing of the image set correctly.

void fast::UltrasoundImageCropper::setStaticCropping(bool staticCropping)

Parameters
staticCropping

If static cropping is enabled, the cropping parameters are calculated only for the first frame. Otherwise, it is recalculated for every frame.