fast::PatchGenerator class

Generates a stream of patches from an ImagePyramid or 3D Image.

The patch generator tiles an ImagePyramid or 3D image into equal sized patches. Although the patches can be smaller at the edges if the image size is not dividable by the patch size. The result of the processed patches can be stitched together again to form a full ImagePyramid/3D Image/Tensor by using the PatchStitcher.

Base classes

class Streamer
Abstract base class for all Streamers.

Constructors, destructors, conversion operators

~PatchGenerator()

Public functions

auto create(int width, int height, int depth, int level, float magnification, float overlapPercent, float maskThreshold, int paddingValue) void setPatchSize(int width -> std::shared_ptr<PatchGenerator>
Creates a PatchGenerator instance.
void setOverlap(float percent)
void setPatchLevel(int level)
void setPatchMagnification(float magnification)
void setMaskThreshold(float percent)
void setPaddingValue(int paddingValue)
void loadAttributes() override
auto getProgress() -> float
Get progress of this patch generator in percent.

Public variables

int height
int int depth

Protected functions

void execute() override
void generateStream() override

Protected variables

int m_width
int m_height
int m_depth
float m_overlapPercent
float m_maskThreshold
int m_paddingValue
float m_magnification
float m_progress
std::shared_ptr<ImagePyramid> m_inputImagePyramid
std::shared_ptr<Image> m_inputVolume
std::shared_ptr<Image> m_inputMask
int m_level

Function documentation

std::shared_ptr<PatchGenerator> fast::PatchGenerator::create(int width, int height, int depth, int level, float magnification, float overlapPercent, float maskThreshold, int paddingValue) void setPatchSize(int width

Creates a PatchGenerator instance.

Parameters
width Width of patch (Note: patches can be smaller at boundaries and will be padded)
height
depth
level Which level of an ImagePyramid to generate patches from.
magnification Which magnification to extract patches from. Setting this value for instance to 20, will trigger a search through all levels to find an image pyramid level which is close to 20X magnification (0.0005 mm pixel spacing). If such a level doesn't exist, FAST will look for a higher magnification level (e.g. 40X) and then resize 40X patches to create 20X patches. This will off course come at an increased runtime cost. This parameter overrides the level parameter.
overlapPercent Amount of patch overlap in percent.
maskThreshold Threshold to accept a patch if the additional mask is provided.
paddingValue Value to pad patches with when out-of-bounds. Default is negative, meaning it will use (white)255 for color images, and (black)0 for grayscale images
Returns instance

void fast::PatchGenerator::setOverlap(float percent)

Parameters
percent

Set overlap of generated patches, in percent of patch size.

float fast::PatchGenerator::getProgress()

Get progress of this patch generator in percent.

Returns progress in percent 0.0-1.0

void fast::PatchGenerator::generateStream() override protected

The function producing the data stream