STIRA  0.1
Public Member Functions | Static Public Member Functions | List of all members
stira::imageanalysis::FloodFill Class Reference

class that implements a simple flood fill Based on recursive implementation described in http://en.wikipedia.org/wiki/Flood_fill More...

#include <FloodFill.h>

Public Member Functions

 FloodFill ()
 constructor
 
int Run (ArrayGrid< int > *pGrid, int nodeX, int nodeY, int targetValue, int replacementValue, bool fill8Connected=true)
 Run method of the fill. More...
 
std::vector< common::Point< int > > GetFloodedPixels ()
 Gets a vector with the pixels that were flooded during the Run. More...
 
common::Point< double > GetCenterOfGravity ()
 Gets the center of gravity of the region that was flooded if the region was empty, the point (0,0) is returned. More...
 
common::RectangularROI< int > GetBoundingBox ()
 Gets the bounding box of the region that was flooded if the region was empty, the point (0,0) is returned. More...
 

Static Public Member Functions

static ArrayGrid< int > * PrepareValues (ArrayGrid< double > *pGrid, int lowerBound, int upperBound, int targetValue)
 allows to prepare a help grid to deal with filling between two thresholds instead of filling a single value in a grid More...
 

Detailed Description

class that implements a simple flood fill Based on recursive implementation described in http://en.wikipedia.org/wiki/Flood_fill

Member Function Documentation

common::RectangularROI< int > stira::imageanalysis::FloodFill::GetBoundingBox ( )

Gets the bounding box of the region that was flooded if the region was empty, the point (0,0) is returned.

Warning
call is only valid after Run was called!!!
Returns
point that is center of gravity of the pixels that were flooded during the Run
common::Point< double > stira::imageanalysis::FloodFill::GetCenterOfGravity ( )

Gets the center of gravity of the region that was flooded if the region was empty, the point (0,0) is returned.

Warning
call is only valid after Run was called!!!
Returns
point that is center of gravity of the pixels that were flooded during the Run
std::vector< Point< int > > stira::imageanalysis::FloodFill::GetFloodedPixels ( )

Gets a vector with the pixels that were flooded during the Run.

Warning
call is only valid after Run was called!!!
Returns
vector with the pixels that were flooded during the Run
ArrayGrid< int > * stira::imageanalysis::FloodFill::PrepareValues ( ArrayGrid< double > *  pGrid,
int  lowerBound,
int  upperBound,
int  targetValue 
)
static

allows to prepare a help grid to deal with filling between two thresholds instead of filling a single value in a grid

Parameters
pGridinput grid
lowerBoundlower bound value for filling
upperBoundupper bound value for filling
targetValuevalue that all values in the range between lowerBound and upperBound are replaced with
Returns
a new grid in which the range between lowerBound and upperBound is replaced by a single value
Warning
the return grid becomes the responsability of the caller to delete.

References stira::imagedata::ArrayGrid< T >::GetHeight(), stira::imagedata::ArrayGrid< T >::GetValue(), stira::imagedata::ArrayGrid< T >::GetWidth(), and stira::imagedata::ArrayGrid< T >::SetValue().

int stira::imageanalysis::FloodFill::Run ( ArrayGrid< int > *  pGrid,
int  nodeX,
int  nodeY,
int  targetValue,
int  replacementValue,
bool  fill8Connected = true 
)

Run method of the fill.

Parameters
pGridgrid to be filled
nodeXx coordinate of starting seed
nodeYy coordinate of starting seed
targetValuevalue to be replaced
replacementValuevalue to replace targetValue by
Returns
the number of pixels filled by this flooding

The documentation for this class was generated from the following files: