Volume Cartographer 2.27.0
|
ThinnedFloodFillSegmentation. More...
#include <vc/segmentation/ThinnedFloodFillSegmentation.hpp>
Public Types | |
using | VoxelMask = volcart::PointSet< cv::Vec3i > |
![]() | |
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 | |
ThinnedFloodFillSegmentation & | operator= (const ThinnedFloodFillSegmentation &)=default |
ThinnedFloodFillSegmentation (ThinnedFloodFillSegmentation &&)=default | |
ThinnedFloodFillSegmentation & | operator= (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... | |
![]() | |
RegionGrowingSegmentationAlgorithmBaseClass (const RegionGrowingSegmentationAlgorithmBaseClass &)=default | |
RegionGrowingSegmentationAlgorithmBaseClass & | operator= (const RegionGrowingSegmentationAlgorithmBaseClass &)=default |
RegionGrowingSegmentationAlgorithmBaseClass (RegionGrowingSegmentationAlgorithmBaseClass &&)=default | |
RegionGrowingSegmentationAlgorithmBaseClass & | operator= (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 PointSet & | getPointSet () const |
Get the segmented points. More... | |
PointSet & | getPointSet () |
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< PointSet > | pointsetUpdated |
Signal< VoxelMask > | maskUpdated |
![]() | |
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 | |
![]() | |
RegionGrowingSegmentationAlgorithmBaseClass ()=default | |
![]() | |
Volume::Pointer | vol_ |
SeedPoints | startingPoints_ |
PointSet | result_ |
std::size_t | iterations_ {0} |
Status | status_ {Status::Success} |
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.
using volcart::segmentation::ThinnedFloodFillSegmentation::VoxelMask = volcart::PointSet<cv::Vec3i> |
Definition at line 44 of file ThinnedFloodFillSegmentation.hpp.
|
overridedefault |
Default destructor
|
default |
Default copy constructor
|
default |
Default move constructor
|
overridevirtual |
Computes the segmentation.
Implements volcart::segmentation::RegionGrowingSegmentationAlgorithmBaseClass.
|
default |
Default copy operator
|
default |
Default move operator
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.
|
private |
Distance transform threshold parameter
Definition at line 121 of file ThinnedFloodFillSegmentation.hpp.
|
private |
Dump visualization to disk flag
Definition at line 125 of file ThinnedFloodFillSegmentation.hpp.
|
private |
High flood-fill threshold parameter
Definition at line 119 of file ThinnedFloodFillSegmentation.hpp.
|
private |
(Square) Kernel size parameter for the closing operation
Definition at line 123 of file ThinnedFloodFillSegmentation.hpp.
|
private |
Low flood-fill threshold parameter
Definition at line 117 of file ThinnedFloodFillSegmentation.hpp.
Sends when the layer mask is updated with intermediate results
Definition at line 49 of file ThinnedFloodFillSegmentation.hpp.
|
private |
Maximum layer thickness to consider for a single seed point
Definition at line 134 of file ThinnedFloodFillSegmentation.hpp.
|
private |
Indicate which direction thickness should be measured in. Horizontal by default
Definition at line 132 of file ThinnedFloodFillSegmentation.hpp.
Sends when the segmentation is updated with intermediate results
Definition at line 47 of file ThinnedFloodFillSegmentation.hpp.
|
private |
Prune spurs of this length or shorter
Definition at line 127 of file ThinnedFloodFillSegmentation.hpp.
|
private |
Mask
Definition at line 136 of file ThinnedFloodFillSegmentation.hpp.