Volume Cartographer 2.27.0
|
Optical Flow Segmentation. More...
#include <vc/segmentation/OpticalFlowSegmentation.hpp>
Public Types | |
using | Pointer = std::shared_ptr< OpticalFlowSegmentation > |
![]() | |
enum class | Status { Success , Failure , ReturnedEarly } |
using | Pointer = std::shared_ptr< ChainSegmentationAlgorithm > |
using | Chain = std::vector< cv::Vec3d > |
using | PointSet = volcart::OrderedPointSet< cv::Vec3d > |
using | Bounds = volcart::BoundingBox< double, 3 > |
Public Member Functions | |
OpticalFlowSegmentation ()=default | |
Default constructor. | |
~OpticalFlowSegmentation () override=default | |
void | setTargetZIndex (int z) |
Set the target z-index. | |
void | setOutsideThreshold (std::uint8_t outside) |
Set the threshold of what pixel brightness is considered inside a sheet (higher as threshold) and outside (lower as threshold) | |
void | setOFThreshold (std::uint8_t ofThr) |
Set the threshold of what pixel brightness is considered while calculating optical flow, darker pixels OF is interpolated from brighter ones in the area. | |
void | setOFDispThreshold (std::uint32_t ofDispThrs) |
Set the maximum single pixel optical flow displacement before interpolating a pixel region. | |
void | setSmoothBrightnessThreshold (std::uint8_t brightness) |
Set the threshold for what pixel brightness is considered as being outside the sheet. Pixels above this threshold are considered outside the sheet and are smoothed in an attempt to get them tracking the sheet again. | |
void | setMaterialThickness (double m) |
Set the estimated thickness of the substrate (in um) More... | |
void | setMaxThreads (std::uint32_t t) |
Set the maximum number of threads. | |
void | resetMaxThreads () |
Clear the maximum number of threads. | |
void | setVisualize (bool b) |
void | setDumpVis (bool b) |
auto | compute () -> PointSet override |
Compute the segmentation. More... | |
auto | progressIterations () const -> std::size_t override |
Returns the maximum progress value. More... | |
![]() | |
virtual | ~ChainSegmentationAlgorithm ()=default |
auto | progressIterations () const -> std::size_t override |
Returns the maximum progress value. More... | |
void | setVolume (Volume::Pointer vol) |
Set the input Volume. More... | |
void | setBounds (Bounds b) |
Set the bounding box for computation. More... | |
void | setChain (Chain c) |
Set the input chain of seed points. More... | |
void | setNumberOfSteps (std::size_t n) |
Set the number of propagation steps. More... | |
void | setStepSize (double s) |
Set the propagation step size. More... | |
auto | getStatus () const -> Status |
Get the status of the previous computation. More... | |
auto | getPointSet () const -> const PointSet & |
Get the segmented pointset. More... | |
auto | getPointSet () -> PointSet & |
Get the segmented pointset. More... | |
virtual std::size_t | progressIterations () const =0 |
Static Public Member Functions | |
template<typename... Args> | |
static auto | New (Args... args) -> Pointer |
Private Member Functions | |
auto | compute_curve_ (const FittedCurve ¤tCurve, int zIndex) -> std::vector< Voxel > |
Compute the curve for z + 1 given a curve on z using the optical flow between the two slices. | |
auto | draw_particle_on_slice_ (const FittedCurve &curve, int sliceIndex, int particleIndex=-1, bool showSpline=false) const -> cv::Mat |
Debug: Draw curve on slice image. More... | |
auto | create_final_pointset_ (const std::vector< std::vector< Voxel > > &points) -> PointSet |
Convert the internal storage array into a final PointSet. | |
Private Attributes | |
int | endIndex_ {0} |
std::uint8_t | outsideThreshold_ {80} |
std::uint8_t | opticalFlowPixelThreshold_ {80} |
std::uint32_t | opticalFlowDisplacementThreshold_ {10} |
std::uint8_t | smoothByBrightness_ {180} |
double | materialThickness_ {100} |
std::optional< std::uint32_t > | maxThreads_ |
bool | dumpVis_ {false} |
bool | visualize_ {false} |
Additional Inherited Members | |
![]() | |
Signal | progressStarted |
Signal< std::size_t > | progressUpdated |
Signal | progressComplete |
![]() | |
ChainSegmentationAlgorithm ()=default | |
![]() | |
Volume::Pointer | vol_ |
Chain | startingChain_ |
Bounds | bb_ |
std::size_t | numSteps_ {0} |
double | stepSize_ {1.0} |
PointSet | result_ |
Status | status_ {Status::Success} |
Optical Flow Segmentation.
This algorithm propagates a chain of points forward through a volume from a starting z-index to an ending z-index (inclusive). It uses optical flow to track the shape of the layer. Each seed point is assumed to be placed within the layer rather than on its surface boundary.
Definition at line 31 of file OpticalFlowSegmentation.hpp.
using volcart::segmentation::OpticalFlowSegmentation::Pointer = std::shared_ptr<OpticalFlowSegmentation> |
Pointer
Definition at line 35 of file OpticalFlowSegmentation.hpp.
|
overridedefault |
Default destructor
|
overridevirtual |
Compute the segmentation.
Implements volcart::segmentation::ChainSegmentationAlgorithm.
|
private |
Debug: Draw curve on slice image.
curve | Input curve |
sliceIndex | Slice on which to draw |
particleIndex | Highlight point at particleIndex |
showSpline | Draw interpolated curve. Default only draws points |
|
inlinestatic |
Make a new shared instance
Definition at line 45 of file OpticalFlowSegmentation.hpp.
|
overridevirtual |
Returns the maximum progress value.
Reimplemented from volcart::segmentation::ChainSegmentationAlgorithm.
void volcart::segmentation::OpticalFlowSegmentation::setDumpVis | ( | bool | b | ) |
Debug: Dumps reslices and intensity maps to disk
void volcart::segmentation::OpticalFlowSegmentation::setMaterialThickness | ( | double | m | ) |
Set the estimated thickness of the substrate (in um)
Used to generate the radius of the structure tensor calculation
void volcart::segmentation::OpticalFlowSegmentation::setVisualize | ( | bool | b | ) |
Debug: Shows intensity maps in GUI window
|
private |
Dump visualization to disk flag
Definition at line 170 of file OpticalFlowSegmentation.hpp.
|
private |
Target z-index
Definition at line 132 of file OpticalFlowSegmentation.hpp.
|
private |
Estimated material thickness in um
Definition at line 166 of file OpticalFlowSegmentation.hpp.
|
private |
Maximum number of threads
Definition at line 168 of file OpticalFlowSegmentation.hpp.
|
private |
Threshold of how many pixel optical flow can displace a point, if higher, recompute optical flow with region's average flow. This parameter sets the maximum single pixel optical flow displacement before interpolating a pixel region. Range minimum: 0. Higher values allow more displacement before interpolation, while lower values trigger interpolation more frequently.
Definition at line 157 of file OpticalFlowSegmentation.hpp.
|
private |
Disregarding pixel that are darker during optical flow computation. This parameter sets the threshold for what pixel brightness is considered while calculating optical flow. Darker pixels' optical flow is interpolated from brighter ones in the area. Range: 0-255. Higher values disregard more dark pixels during computation, while lower values include more dark pixels.
Definition at line 148 of file OpticalFlowSegmentation.hpp.
|
private |
Darker pixels are considered outside the sheet. This parameter sets the threshold of what pixel brightness is considered too deep inside a sheet (higher than the threshold) and then tries to smoothen those points back towards the edge of the sheet. Range: 0-255.
Definition at line 139 of file OpticalFlowSegmentation.hpp.
|
private |
This parameter sets the threshold for what pixel brightness is considered as being outside the sheet. Pixels considered outside the sheet are smoothed in an attempt to get them tracking the sheet again. Range: 0-255. Smooth curve at pixels above this threshold.
Definition at line 164 of file OpticalFlowSegmentation.hpp.
|
private |
Show visualization in GUI flag
Definition at line 172 of file OpticalFlowSegmentation.hpp.