A centerline is a path with a tree topology that approximates the input shape. The extraction procedure
enforces the path to be equidistant to its boundaries. A Euclidean distance map is computed to control the
path centering.
This algorithm searches for a graph with tree topology (without loops). If objects contain loops, the
algorithm does not fail; instead, it just ignores certain connectivity so that the tree topology of the graph
is preserved.
The algorithm searches iteratively for the longest branch that can be added to the tree.
Secondary branches also can be detected, either by predefining the number of searched branches or by
adding them automatically. In this last case, a new branch is added to the tree at a candidate crossing point,
only if the length b is greater than a sensibility parameter multiplied by the distance a, where a and b are
shown in Figure 1.
Figure 1. New branch sensibility
This algorithm generates two types of output:
A binary or label image representing the detected centerlines by voxels having an intensity greater than or equal to 1.
A geometric output modeling the centerlines by a set of polylines. This line set is provided by two output parameters: a list of vertices, and a list of indexes indicating how the vertices are connected.
Note: This algorithm must have the entire input data loaded in memory to be computed.
Consequently, it cannot be used as part of an out-of-core processing recipe.
// Output structure of the centerline3d function.structCenterline3dOutput{/// The output image. Its size and type are forced to the same values as the input.
std::shared_ptr< iolink::ImageView> outputObjectImage;/// The list of indices of the output line set.
std::shared_ptr<iolink::ArrayXi64> outputIndices;/// The list of vertices of the output line set.
std::shared_ptr<iolink::ArrayXd> outputVertices;};// Function prototype Centerline3dOutput
centerline3d( std::shared_ptr< iolink::ImageView> inputObjectImage,bool autoMode,uint32_t numberOfBranches,double newBranchSensibility,double distanceMapSmoothing,uint32_t lineSetSmoothing,
std::shared_ptr<iolink::ArrayXi64> outputIndices = NULL,
std::shared_ptr<iolink::ArrayXd> outputVertices = NULL,
std::shared_ptr< iolink::ImageView> outputObjectImage = NULL );
/// Output structure of the Centerline3d function.publicstructCenterline3dOutput{/// The output image. Its size and type are forced to the same values as the input.publicIOLink.ImageView outputObjectImage;/// The list of indices of the output line set.publicIOLink.ArrayXi64 outputIndices;/// The list of vertices of the output line set.publicIOLink.ArrayXd outputVertices;};// Function prototype.publicstaticCenterline3dOutputCenterline3d(IOLink.ImageView inputObjectImage,bool autoMode =true,UInt32 numberOfBranches =3,double newBranchSensibility =3,double distanceMapSmoothing =0.3,UInt32 lineSetSmoothing =3,IOLink.ArrayXi64 outputIndices =null,IOLink.ArrayXd outputVertices =null,IOLink.ImageView outputObjectImage =null);
Class Syntax
// Command constructor.Centerline3d();/// Gets the inputObjectImage parameter./// The binary or label input image.
std::shared_ptr< iolink::ImageView> inputObjectImage()const;/// Sets the inputObjectImage parameter./// The binary or label input image.void setInputObjectImage( std::shared_ptr< iolink::ImageView> inputObjectImage );/// Gets the autoMode parameter./// The way to determine the number of branches.bool autoMode()const;/// Sets the autoMode parameter./// The way to determine the number of branches.void setAutoMode(constbool& autoMode );/// Gets the numberOfBranches parameter./// The expected number of branches. This parameter is ignored if autoMode is set to YES.uint32_t numberOfBranches()const;/// Sets the numberOfBranches parameter./// The expected number of branches. This parameter is ignored if autoMode is set to YES.void setNumberOfBranches(constuint32_t& numberOfBranches );/// Gets the newBranchSensibility parameter./// The minimum length of a branch added automatically. This parameter is ignored if autoMode is set to NO.double newBranchSensibility()const;/// Sets the newBranchSensibility parameter./// The minimum length of a branch added automatically. This parameter is ignored if autoMode is set to NO.void setNewBranchSensibility(constdouble& newBranchSensibility );/// Gets the distanceMapSmoothing parameter./// The smoothing level of the distance map. It controls the standard deviation of a Gaussian filter on the distance map, which is computed internally to make the tree centered. Smoothing the distance map can remove artifacts in the tree, like oscillations.double distanceMapSmoothing()const;/// Sets the distanceMapSmoothing parameter./// The smoothing level of the distance map. It controls the standard deviation of a Gaussian filter on the distance map, which is computed internally to make the tree centered. Smoothing the distance map can remove artifacts in the tree, like oscillations.void setDistanceMapSmoothing(constdouble& distanceMapSmoothing );/// Gets the lineSetSmoothing parameter./// The number of smoothing iterations applied to the output polyline set. Each smoothing iteration applies a mean filter of size 3 on the vertices of the polylines.uint32_t lineSetSmoothing()const;/// Sets the lineSetSmoothing parameter./// The number of smoothing iterations applied to the output polyline set. Each smoothing iteration applies a mean filter of size 3 on the vertices of the polylines.void setLineSetSmoothing(constuint32_t& lineSetSmoothing );/// Gets the outputIndices parameter./// The list of indices of the output line set.
std::shared_ptr<iolink::ArrayXi64> outputIndices()const;/// Sets the outputIndices parameter./// The list of indices of the output line set.void setOutputIndices( std::shared_ptr<iolink::ArrayXi64> outputIndices );/// Gets the outputVertices parameter./// The list of vertices of the output line set.
std::shared_ptr<iolink::ArrayXd> outputVertices()const;/// Sets the outputVertices parameter./// The list of vertices of the output line set.void setOutputVertices( std::shared_ptr<iolink::ArrayXd> outputVertices );/// Gets the outputObjectImage parameter./// The output image. Its size and type are forced to the same values as the input.
std::shared_ptr< iolink::ImageView> outputObjectImage()const;/// Sets the outputObjectImage parameter./// The output image. Its size and type are forced to the same values as the input.void setOutputObjectImage( std::shared_ptr< iolink::ImageView> outputObjectImage );// Method to launch the command.void execute();
# Property of the inputObjectImage parameter.Centerline3d.input_object_image
# Property of the autoMode parameter.Centerline3d.auto_mode
# Property of the numberOfBranches parameter.Centerline3d.number_of_branches
# Property of the newBranchSensibility parameter.Centerline3d.new_branch_sensibility
# Property of the distanceMapSmoothing parameter.Centerline3d.distance_map_smoothing
# Property of the lineSetSmoothing parameter.Centerline3d.line_set_smoothing
# Property of the outputIndices parameter.Centerline3d.output_indices
# Property of the outputVertices parameter.Centerline3d.output_vertices
# Property of the outputObjectImage parameter.Centerline3d.output_object_image
// Method to launch the command.
execute()
// Command constructor.Centerline3d()// Property of the inputObjectImage parameter.Centerline3d.inputObjectImage
// Property of the autoMode parameter.Centerline3d.autoMode
// Property of the numberOfBranches parameter.Centerline3d.numberOfBranches
// Property of the newBranchSensibility parameter.Centerline3d.newBranchSensibility
// Property of the distanceMapSmoothing parameter.Centerline3d.distanceMapSmoothing
// Property of the lineSetSmoothing parameter.Centerline3d.lineSetSmoothing
// Property of the outputIndices parameter.Centerline3d.outputIndices
// Property of the outputVertices parameter.Centerline3d.outputVertices
// Property of the outputObjectImage parameter.Centerline3d.outputObjectImage
// Method to launch the command.Execute()
Parameters
Parameter Name
Description
Type
Supported Values
Default Value
inputObjectImage
The binary or label input image.
Image
Binary or Label
nullptr
autoMode
The way to determine the number of branches.
NO
The number of branches is user defined. Branches are added until the numberOfBranches connections is reached.
YES
The number of branches is automatically detected in accordance with the newBranchSensibility parameter.
Bool
true
numberOfBranches
The expected number of branches. This parameter is ignored if autoMode is set to YES.
UInt32
>=1
3
newBranchSensibility
The minimum length of a branch added automatically. This parameter is ignored if autoMode is set to NO.
Float64
>=1
3
distanceMapSmoothing
The smoothing level of the distance map. It controls the standard deviation of a Gaussian filter on the distance map, which is computed internally to make the tree centered. Smoothing the distance map can remove artifacts in the tree, like oscillations.
Float64
>=0.01
0.3
lineSetSmoothing
The number of smoothing iterations applied to the output polyline set. Each smoothing iteration applies a mean filter of size 3 on the vertices of the polylines.
UInt32
Any value
3
outputVertices
The list of vertices of the output line set.
The indexation of the generated arrayX is {coordinate, index}, where coordinate is the axis index (0 for X, 1 for Y, and 2 for Z) and index is a label identifying the vertex.
ArrayXd
nullptr
outputIndices
The list of indices of the output line set.
The vertices corresponding to two consecutive indices of this list are connected.
An index that equals -1 indicates that the current polyline has ended and the next one begins.
ArrayXi64
nullptr
outputObjectImage
The output image. Its size and type are forced to the same values as the input.
Image
nullptr
Parameter Name
Description
Type
Supported Values
Default Value
input_object_image
The binary or label input image.
image
Binary or Label
None
auto_mode
The way to determine the number of branches.
NO
The number of branches is user defined. Branches are added until the numberOfBranches connections is reached.
YES
The number of branches is automatically detected in accordance with the newBranchSensibility parameter.
bool
True
number_of_branches
The expected number of branches. This parameter is ignored if autoMode is set to YES.
uint32
>=1
3
new_branch_sensibility
The minimum length of a branch added automatically. This parameter is ignored if autoMode is set to NO.
float64
>=1
3
distance_map_smoothing
The smoothing level of the distance map. It controls the standard deviation of a Gaussian filter on the distance map, which is computed internally to make the tree centered. Smoothing the distance map can remove artifacts in the tree, like oscillations.
float64
>=0.01
0.3
line_set_smoothing
The number of smoothing iterations applied to the output polyline set. Each smoothing iteration applies a mean filter of size 3 on the vertices of the polylines.
uint32
Any value
3
output_vertices
The list of vertices of the output line set.
The indexation of the generated arrayX is {coordinate, index}, where coordinate is the axis index (0 for X, 1 for Y, and 2 for Z) and index is a label identifying the vertex.
arrayXd
nullptr
output_indices
The list of indices of the output line set.
The vertices corresponding to two consecutive indices of this list are connected.
An index that equals -1 indicates that the current polyline has ended and the next one begins.
arrayXi64
nullptr
output_object_image
The output image. Its size and type are forced to the same values as the input.
image
None
Parameter Name
Description
Type
Supported Values
Default Value
inputObjectImage
The binary or label input image.
Image
Binary or Label
null
autoMode
The way to determine the number of branches.
NO
The number of branches is user defined. Branches are added until the numberOfBranches connections is reached.
YES
The number of branches is automatically detected in accordance with the newBranchSensibility parameter.
Bool
true
numberOfBranches
The expected number of branches. This parameter is ignored if autoMode is set to YES.
UInt32
>=1
3
newBranchSensibility
The minimum length of a branch added automatically. This parameter is ignored if autoMode is set to NO.
Float64
>=1
3
distanceMapSmoothing
The smoothing level of the distance map. It controls the standard deviation of a Gaussian filter on the distance map, which is computed internally to make the tree centered. Smoothing the distance map can remove artifacts in the tree, like oscillations.
Float64
>=0.01
0.3
lineSetSmoothing
The number of smoothing iterations applied to the output polyline set. Each smoothing iteration applies a mean filter of size 3 on the vertices of the polylines.
UInt32
Any value
3
outputVertices
The list of vertices of the output line set.
The indexation of the generated arrayX is {coordinate, index}, where coordinate is the axis index (0 for X, 1 for Y, and 2 for Z) and index is a label identifying the vertex.
ArrayXd
nullptr
outputIndices
The list of indices of the output line set.
The vertices corresponding to two consecutive indices of this list are connected.
An index that equals -1 indicates that the current polyline has ended and the next one begins.
ArrayXi64
nullptr
outputObjectImage
The output image. Its size and type are forced to the same values as the input.