Volume Cartographer 2.27.0
Public Types | Public Member Functions | Public Attributes | Private Attributes | List of all members
volcart::segmentation::ThinnedFloodFillSegmentation Class Reference

ThinnedFloodFillSegmentation. More...

#include <vc/segmentation/ThinnedFloodFillSegmentation.hpp>

Inheritance diagram for volcart::segmentation::ThinnedFloodFillSegmentation:
[legend]
Collaboration diagram for volcart::segmentation::ThinnedFloodFillSegmentation:
[legend]

Public Types

using VoxelMask = volcart::PointSet< cv::Vec3i >
 
- Public Types inherited from volcart::segmentation::RegionGrowingSegmentationAlgorithmBaseClass
enum class  Status { Success , Failure , ReturnedEarly }
 
using SeedPoints = std::vector< cv::Vec3d >
 
using PointSet = volcart::PointSet< cv::Vec3d >
 

Public Member Functions

 ThinnedFloodFillSegmentation ()=default
 Default constructor.
 
 ~ThinnedFloodFillSegmentation () override=default
 
 ThinnedFloodFillSegmentation (const ThinnedFloodFillSegmentation &)=default
 
ThinnedFloodFillSegmentationoperator= (const ThinnedFloodFillSegmentation &)=default
 
 ThinnedFloodFillSegmentation (ThinnedFloodFillSegmentation &&)=default
 
ThinnedFloodFillSegmentationoperator= (ThinnedFloodFillSegmentation &&)=default
 
void setFFLowThreshold (std::uint16_t t)
 Set the low threshold for the bounded flood-fill operation.
 
void setFFHighThreshold (std::uint16_t t)
 Set the high threshold for the bounded flood-fill operation.
 
void setDistanceTransformThreshold (float t)
 Set the threshold for the distance transform pre-processing operation.
 
void setClosingKernelSize (int s)
 Set the kernel size used in the closing operation. Larger kernels close bigger gaps.
 
void setMeasureVertical (bool b)
 Set the direction in which the thickness of the page will be measured. If this value is false, the thickness will be measured horizontally (+/- x)
 
void setSpurLengthThreshold (int length)
 Set the max length of spurs that can be pruned.

 
void setMaxRadius (std::size_t radius)
 Set the max radius that a single point can hav when measuring the width of the page.
 
PointSet compute () override
 Computes the segmentation. More...
 
VoxelMask getMask () const
 Return the full, 3D mask.
 
void setDumpVis (bool b)
 Debug: Dumps visualizations of the mask and skeleton for each slice to disk. More...
 
- Public Member Functions inherited from volcart::segmentation::RegionGrowingSegmentationAlgorithmBaseClass
 RegionGrowingSegmentationAlgorithmBaseClass (const RegionGrowingSegmentationAlgorithmBaseClass &)=default
 
RegionGrowingSegmentationAlgorithmBaseClassoperator= (const RegionGrowingSegmentationAlgorithmBaseClass &)=default
 
 RegionGrowingSegmentationAlgorithmBaseClass (RegionGrowingSegmentationAlgorithmBaseClass &&)=default
 
RegionGrowingSegmentationAlgorithmBaseClassoperator= (RegionGrowingSegmentationAlgorithmBaseClass &&)=default
 
void setVolume (Volume::Pointer vol)
 Set the input Volume. More...
 
void setSeedPoints (SeedPoints p)
 Set the input seed points. More...
 
void setIterations (std::size_t i)
 Set the number of iterations. More...
 
virtual PointSet compute ()=0
 Compute the segmentation. More...
 
Status getStatus () const
 Get the status of the previous computation. More...
 
const PointSetgetPointSet () const
 Get the segmented points. More...
 
PointSetgetPointSet ()
 Get the segmented points. More...
 
std::size_t progressIterations () const override
 Returns the maximum progress value. More...
 
virtual std::size_t progressIterations () const =0
 

Public Attributes

Signal< PointSetpointsetUpdated
 
Signal< VoxelMaskmaskUpdated
 
- Public Attributes inherited from volcart::IterationsProgress
Signal progressStarted
 
Signal< std::size_t > progressUpdated
 
Signal progressComplete
 

Private Attributes

std::uint16_t low_ {14135}
 
std::uint16_t high_ {65535}
 
float dtt_ {0}
 
int kernel_ {5}
 
bool dumpVis_ {false}
 
std::size_t spurLength_ {6}
 
bool measureVertically_ {false}
 
std::size_t maxRadius_ {std::numeric_limits<std::size_t>::max()}
 
VoxelMask volMask_
 

Additional Inherited Members

- Protected Member Functions inherited from volcart::segmentation::RegionGrowingSegmentationAlgorithmBaseClass
 RegionGrowingSegmentationAlgorithmBaseClass ()=default
 
- Protected Attributes inherited from volcart::segmentation::RegionGrowingSegmentationAlgorithmBaseClass
Volume::Pointer vol_
 
SeedPoints startingPoints_
 
PointSet result_
 
std::size_t iterations_ {0}
 
Status status_ {Status::Success}
 

Detailed Description

ThinnedFloodFillSegmentation.

The algorithm begins with a user-defined set of seed points. The estimated median thickness of the page is calculated from each seed point. A flood-fill operation begins at each seed point, extending outwards to neighboring pixels–within the boundary imposed on the original seed point by the estimated median thickness–if the neighboring pixels are within the user-specified grey threshold. The mask that each seed point creates overlaps with the other masks, creating a full-thickness segmentation of the page. The mask is then thinned to a continuous (as much as possible) skeleton that is centered inside the thickness of the page. Any spurs are removed from the skeleton. All the points in the skeleton are used as seed points for the next slice. Using this approach results in a full-thickness segmentation of the page for each slice.

Note: This algorithm operates solely on two-dimensional slices and does not use any 3D subvolumes.

Implements the thinning algorithm described in section 8.6 of "Computer Vision: Principles, Algorithms, Applications, Learning" by E.R. Davies [davies2017computervision].

Definition at line 40 of file ThinnedFloodFillSegmentation.hpp.

Member Typedef Documentation

◆ VoxelMask

Definition at line 44 of file ThinnedFloodFillSegmentation.hpp.

Constructor & Destructor Documentation

◆ ~ThinnedFloodFillSegmentation()

volcart::segmentation::ThinnedFloodFillSegmentation::~ThinnedFloodFillSegmentation ( )
overridedefault

Default destructor

◆ ThinnedFloodFillSegmentation() [1/2]

volcart::segmentation::ThinnedFloodFillSegmentation::ThinnedFloodFillSegmentation ( const ThinnedFloodFillSegmentation )
default

Default copy constructor

◆ ThinnedFloodFillSegmentation() [2/2]

volcart::segmentation::ThinnedFloodFillSegmentation::ThinnedFloodFillSegmentation ( ThinnedFloodFillSegmentation &&  )
default

Default move constructor

Member Function Documentation

◆ compute()

PointSet volcart::segmentation::ThinnedFloodFillSegmentation::compute ( )
overridevirtual

◆ operator=() [1/2]

ThinnedFloodFillSegmentation & volcart::segmentation::ThinnedFloodFillSegmentation::operator= ( const ThinnedFloodFillSegmentation )
default

Default copy operator

◆ operator=() [2/2]

ThinnedFloodFillSegmentation & volcart::segmentation::ThinnedFloodFillSegmentation::operator= ( ThinnedFloodFillSegmentation &&  )
default

Default move operator

◆ setDumpVis()

void volcart::segmentation::ThinnedFloodFillSegmentation::setDumpVis ( bool  b)

Debug: Dumps visualizations of the mask and skeleton for each slice to disk.

Images are saved in the 'dumpvis' folder, created relative to the working directory.

Member Data Documentation

◆ dtt_

float volcart::segmentation::ThinnedFloodFillSegmentation::dtt_ {0}
private

Distance transform threshold parameter

Definition at line 121 of file ThinnedFloodFillSegmentation.hpp.

◆ dumpVis_

bool volcart::segmentation::ThinnedFloodFillSegmentation::dumpVis_ {false}
private

Dump visualization to disk flag

Definition at line 125 of file ThinnedFloodFillSegmentation.hpp.

◆ high_

std::uint16_t volcart::segmentation::ThinnedFloodFillSegmentation::high_ {65535}
private

High flood-fill threshold parameter

Definition at line 119 of file ThinnedFloodFillSegmentation.hpp.

◆ kernel_

int volcart::segmentation::ThinnedFloodFillSegmentation::kernel_ {5}
private

(Square) Kernel size parameter for the closing operation

Definition at line 123 of file ThinnedFloodFillSegmentation.hpp.

◆ low_

std::uint16_t volcart::segmentation::ThinnedFloodFillSegmentation::low_ {14135}
private

Low flood-fill threshold parameter

Definition at line 117 of file ThinnedFloodFillSegmentation.hpp.

◆ maskUpdated

Signal<VoxelMask> volcart::segmentation::ThinnedFloodFillSegmentation::maskUpdated

Sends when the layer mask is updated with intermediate results

Definition at line 49 of file ThinnedFloodFillSegmentation.hpp.

◆ maxRadius_

std::size_t volcart::segmentation::ThinnedFloodFillSegmentation::maxRadius_ {std::numeric_limits<std::size_t>::max()}
private

Maximum layer thickness to consider for a single seed point

Definition at line 134 of file ThinnedFloodFillSegmentation.hpp.

◆ measureVertically_

bool volcart::segmentation::ThinnedFloodFillSegmentation::measureVertically_ {false}
private

Indicate which direction thickness should be measured in. Horizontal by default

Definition at line 132 of file ThinnedFloodFillSegmentation.hpp.

◆ pointsetUpdated

Signal<PointSet> volcart::segmentation::ThinnedFloodFillSegmentation::pointsetUpdated

Sends when the segmentation is updated with intermediate results

Definition at line 47 of file ThinnedFloodFillSegmentation.hpp.

◆ spurLength_

std::size_t volcart::segmentation::ThinnedFloodFillSegmentation::spurLength_ {6}
private

Prune spurs of this length or shorter

Definition at line 127 of file ThinnedFloodFillSegmentation.hpp.

◆ volMask_

VoxelMask volcart::segmentation::ThinnedFloodFillSegmentation::volMask_
private

Mask

Definition at line 136 of file ThinnedFloodFillSegmentation.hpp.


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