IPSDK  4_1_0_2
IPSDK : Image Processing Software Development Kit

Computes the shortest path from one border to its opposite, given distance ponderation map. More...

IPSDKIPLADVANCEDMORPHOLOGY_API ipsdk::imaproc::attr::RidgeLine3dResult ipsdk::imaproc::advmorpho::ridgeLine3dImg (const ipsdk::image::ImageConstPtr &pInImg3d, const ipsdk::imaproc::attr::ePropagationAxis &pInPropagationAxis, const ipsdk::imaproc::attr::ePropagationDirection &pInPropagationDirection)
 wrapper function for Computes the shortest path from one border to its opposite, given distance ponderation map. More...
 
IPSDKIPLADVANCEDMORPHOLOGY_API ipsdk::imaproc::attr::RidgeLine3dResult ipsdk::imaproc::advmorpho::ridgeLine3dImg (const ipsdk::image::ImageConstPtr &pInImg3d, const ipsdk::image::ImageConstPtr &pInOptMaskImg, const ipsdk::imaproc::attr::ePropagationAxis &pInPropagationAxis, const ipsdk::imaproc::attr::ePropagationDirection &pInPropagationDirection)
 wrapper function for Computes the shortest path from one border to its opposite, given distance ponderation map. More...
 
IPSDKIPLADVANCEDMORPHOLOGY_API ipsdk::imaproc::attr::Voxels3dPtr ipsdk::imaproc::advmorpho::ridgeLine3dImg (const ipsdk::image::ImageConstPtr &pInImg3d, const ipsdk::imaproc::attr::ePropagationAxis &pInPropagationAxis, const ipsdk::imaproc::attr::ePropagationDirection &pInPropagationDirection, const ipsdk::image::ImagePtr &pOutShortestPathImg, const ipsdk::image::ImagePtr &pOutDistanceMap, const ipsdk::image::ImagePtr &pOutPathMap)
 wrapper function for Computes the shortest path from one border to its opposite, given distance ponderation map. More...
 
IPSDKIPLADVANCEDMORPHOLOGY_API ipsdk::imaproc::attr::RidgeLine3dResult ipsdk::imaproc::advmorpho::ridgeLine3dImg (const ipsdk::image::ImageConstPtr &pInImg3d, const ipsdk::imaproc::attr::ePropagationAxis &pInPropagationAxis, const ipsdk::imaproc::attr::ePropagationDirection &pInPropagationDirection, const ipsdk::ipUInt32 nbIter)
 wrapper function for Computes the shortest path from one border to its opposite, given distance ponderation map. More...
 
IPSDKIPLADVANCEDMORPHOLOGY_API ipsdk::imaproc::attr::RidgeLine3dResult ipsdk::imaproc::advmorpho::ridgeLine3dImg (const ipsdk::image::ImageConstPtr &pInImg3d, const ipsdk::image::ImageConstPtr &pInOptMaskImg, const ipsdk::imaproc::attr::ePropagationAxis &pInPropagationAxis, const ipsdk::imaproc::attr::ePropagationDirection &pInPropagationDirection, const ipsdk::ipUInt32 nbIter)
 wrapper function for Computes the shortest path from one border to its opposite, given distance ponderation map. More...
 
IPSDKIPLADVANCEDMORPHOLOGY_API ipsdk::imaproc::attr::Voxels3dPtr ipsdk::imaproc::advmorpho::ridgeLine3dImg (const ipsdk::image::ImageConstPtr &pInImg3d, const ipsdk::image::ImageConstPtr &pInOptMaskImg, const ipsdk::imaproc::attr::ePropagationAxis &pInPropagationAxis, const ipsdk::imaproc::attr::ePropagationDirection &pInPropagationDirection, const ipsdk::image::ImagePtr &pOutShortestPathImg, const ipsdk::image::ImagePtr &pOutDistanceMap, const ipsdk::image::ImagePtr &pOutPathMap)
 wrapper function for Computes the shortest path from one border to its opposite, given distance ponderation map. More...
 
IPSDKIPLADVANCEDMORPHOLOGY_API ipsdk::imaproc::attr::Voxels3dPtr ipsdk::imaproc::advmorpho::ridgeLine3dImg (const ipsdk::image::ImageConstPtr &pInImg3d, const ipsdk::imaproc::attr::ePropagationAxis &pInPropagationAxis, const ipsdk::imaproc::attr::ePropagationDirection &pInPropagationDirection, const ipsdk::ipUInt32 nbIter, const ipsdk::image::ImagePtr &pOutShortestPathImg, const ipsdk::image::ImagePtr &pOutDistanceMap, const ipsdk::image::ImagePtr &pOutPathMap)
 wrapper function for Computes the shortest path from one border to its opposite, given distance ponderation map. More...
 
IPSDKIPLADVANCEDMORPHOLOGY_API ipsdk::imaproc::attr::Voxels3dPtr ipsdk::imaproc::advmorpho::ridgeLine3dImg (const ipsdk::image::ImageConstPtr &pInImg3d, const ipsdk::image::ImageConstPtr &pInOptMaskImg, const ipsdk::imaproc::attr::ePropagationAxis &pInPropagationAxis, const ipsdk::imaproc::attr::ePropagationDirection &pInPropagationDirection, const ipsdk::ipUInt32 nbIter, const ipsdk::image::ImagePtr &pOutShortestPathImg, const ipsdk::image::ImagePtr &pOutDistanceMap, const ipsdk::image::ImagePtr &pOutPathMap)
 wrapper function for Computes the shortest path from one border to its opposite, given distance ponderation map. More...
 
IPSDKIPLADVANCEDMORPHOLOGY_API ipsdk::imaproc::attr::PlanIndexedVoxels3dPtr ipsdk::imaproc::advmorpho::ridgeLine3dImg_multiSlice (const ipsdk::image::ImageConstPtr &pInImg3d, const ipsdk::imaproc::attr::ePropagationAxis &pInPropagationAxis, const ipsdk::imaproc::attr::ePropagationDirection &pInPropagationDirection, const ipsdk::image::ImagePtr &pOutShortestPathImg, const ipsdk::image::ImagePtr &pOutDistanceMap, const ipsdk::image::ImagePtr &pOutPathMap)
 wrapper function for Computes the shortest path from one border to its opposite, given distance ponderation map. More...
 
IPSDKIPLADVANCEDMORPHOLOGY_API ipsdk::imaproc::attr::PlanIndexedVoxels3dPtr ipsdk::imaproc::advmorpho::ridgeLine3dImg_multiSlice (const ipsdk::image::ImageConstPtr &pInImg3d, const ipsdk::image::ImageConstPtr &pInOptMaskImg, const ipsdk::imaproc::attr::ePropagationAxis &pInPropagationAxis, const ipsdk::imaproc::attr::ePropagationDirection &pInPropagationDirection, const ipsdk::image::ImagePtr &pOutShortestPathImg, const ipsdk::image::ImagePtr &pOutDistanceMap, const ipsdk::image::ImagePtr &pOutPathMap)
 wrapper function for Computes the shortest path from one border to its opposite, given distance ponderation map. More...
 
IPSDKIPLADVANCEDMORPHOLOGY_API ipsdk::imaproc::attr::PlanIndexedVoxels3dPtr ipsdk::imaproc::advmorpho::ridgeLine3dImg_multiSlice (const ipsdk::image::ImageConstPtr &pInImg3d, const ipsdk::imaproc::attr::ePropagationAxis &pInPropagationAxis, const ipsdk::imaproc::attr::ePropagationDirection &pInPropagationDirection, const ipsdk::ipUInt32 nbIter, const ipsdk::image::ImagePtr &pOutShortestPathImg, const ipsdk::image::ImagePtr &pOutDistanceMap, const ipsdk::image::ImagePtr &pOutPathMap)
 wrapper function for Computes the shortest path from one border to its opposite, given distance ponderation map. More...
 
IPSDKIPLADVANCEDMORPHOLOGY_API ipsdk::imaproc::attr::PlanIndexedVoxels3dPtr ipsdk::imaproc::advmorpho::ridgeLine3dImg_multiSlice (const ipsdk::image::ImageConstPtr &pInImg3d, const ipsdk::image::ImageConstPtr &pInOptMaskImg, const ipsdk::imaproc::attr::ePropagationAxis &pInPropagationAxis, const ipsdk::imaproc::attr::ePropagationDirection &pInPropagationDirection, const ipsdk::ipUInt32 nbIter, const ipsdk::image::ImagePtr &pOutShortestPathImg, const ipsdk::image::ImagePtr &pOutDistanceMap, const ipsdk::image::ImagePtr &pOutPathMap)
 wrapper function for Computes the shortest path from one border to its opposite, given distance ponderation map. More...
 

Detailed Description

Computes the shortest path from one border to its opposite, given distance ponderation map.

The 3D ridge line algorithm allows to compute the shortest path to cross an image along the x, y, or z axis. It is also possible to specify the propagation direction. This direction can be direct (from left to right, from top to bottom or from the first to the last slice) or reverse (from right to left, from bottom to top or from the last to the first slice).

The distance between to reach a voxel one of its 26-neighbours is given by its intensity. More the intensity will be important, more the access to the voxel will be unfavourable. This means that the algorithms try to find a path through dark voxels.

The algorithm returns :

The calculation time can be drastically reduced by specifying a number of iterations. If this parameter is higher than 0, the algorithm will stop before converging to the final result. Although the result will be an approximation of the shortest path, it will stay close to the eact result.

Finally, it is possible to specify a propagation area by passing an additional mask as parameter.

The distance for each pixel of the shortest path is given by the intensity field of the Pixel2d data item. It is also possible to obtain the shortest path length for volume (c, t) thanks to the function computeShortestPathLength.

Please, see Ridge Line 2d for an illustration of shortest path in a 2d case.

Attributes description

Attribute description for algorithm :

Name ToolTip Default Initializer
ipsdk::imaproc::attr::InImg3d [Input] 3d image for operation X
ipsdk::imaproc::attr::InOptMaskImg [Input Optional] Binary image for masking operation X
ipsdk::imaproc::attr::InPropagationAxis [Input] input axis propagation for the algorithm X
ipsdk::imaproc::attr::InPropagationDirection [Input] Direction propagation for the algorithm X
ipsdk::imaproc::attr::InNbIter [Input] Number of iterations for an iterative algorithm X
ipsdk::imaproc::attr::OutDistImg [Output] distance map image duplicateInOut (_pOutDistImg, _pInImg3d, ipsdk::image::eImageBufferType::eIBT_Real32)
ipsdk::imaproc::attr::OutIntImg [Output] image containing integers duplicateInOut (_pOutIntImg, _pInImg3d, ipsdk::image::eImageBufferType::eIBT_UInt8)
ipsdk::imaproc::attr::OutBinImg [Output] binary image for processing operation duplicateInOut (_pOutBinImg, _pInImg3d, ipsdk::image::eImageBufferType::eIBT_Binary)
ipsdk::imaproc::attr::OutPIVoxels3d [Output] plan indexed collection of positions and intensities of 3d voxels ipsdk::imaproc::fromImageButVolume (_pOutPIVoxels3d, _pInImg3d)

Global Rule description

Global rule description for algorithm :
ipsdk::imaproc::matchSize (_pInImg3d,_pOutDistImg,_pOutIntImg) && 
ipsdk::imaproc::matchImagePlans (_pOutPIVoxels3d,_pInImg3d,eImagePlansMatchPolicy::eIPMP_CT) && 
ipsdk::processor::If (
 ipsdk::processor::isSet (_pInOptMaskImg),
 ipsdk::imaproc::matchSize (_pInImg3d,_pInOptMaskImg),
 ipsdk::processor::none ()) && 
ipsdk::imaproc::matchSize (_pOutDistImg,_pOutBinImg)

Example of Python code :

Example imports

import PyIPSDK
import PyIPSDK.IPSDKIPLAdvancedMorphology as advmorpho

Code Example

# opening of input images
inImg = PyIPSDK.loadTiffImageFile(inputImgPath)
# generic seeded distance map 3d computation
outImgShortestPath, outPlanIndexedVoxels = advmorpho.ridgeLine3dImg(inImg, PyIPSDK.ePropagationAxis.ePA_X, PyIPSDK.ePropagationDirection.ePD_Direct)
firstShortestPath = PyIPSDK.toPyDict(outPlanIndexedVoxels)[(0, 0, 0)]
print("First shortest path", firstShortestPath)

Example of C++ code :

Example informations

Associated library

IPSDKIPLAdvancedMorphology

Header file

#include <IPSDKIPL/IPSDKIPLAdvancedMorphology/Processor/RidgeLine3dImg/RidgeLine3dImgInitPassLvl3.h>
#include <IPSDKIPL/IPSDKIPLAdvancedMorphology/Processor/RidgeLine3dImg/RidgeLine3dImgDirectPassLvl3.h>
#include <IPSDKIPL/IPSDKIPLAdvancedMorphology/Processor/RidgeLine3dImg/RidgeLine3dImgReversePassLvl3.h>

Code Example

// opening input image
ImagePtr pInImg = loadTiffImageFile(inputImgPath);
// opening optional mask image
ImagePtr pOptMaskImg = loadTiffImageFile(inputOptMaskPath);
// compute distance map on input image without mask
// compute distance map on input image with mask
RidgeLine3dResult rl3d_res_withMask = ridgeLine3dImg(pInImg, pOptMaskImg, ePropagationAxis::ePA_X, ePropagationDirection::ePD_Direct);
// retrieve computed images and the list of pixels
const ImagePtr pShortestPathImg = rl3d_res._pShortestPath;
const PlanIndexedVoxels3dPtr pShortestPathList = rl3d_res._pShortestPathList;
// computes the length of the shortest path
ipReal64 lengthShortestPath = computeShortestPathLength(pShortestPathList, 0, 0);
See also
RidgeLine3dImgLvl1
RidgeLine3dImgLvl2

Function Documentation

◆ ridgeLine3dImg() [1/8]

IPSDKIPLADVANCEDMORPHOLOGY_API ipsdk::imaproc::attr::RidgeLine3dResult ipsdk::imaproc::advmorpho::ridgeLine3dImg ( const ipsdk::image::ImageConstPtr pInImg3d,
const ipsdk::imaproc::attr::ePropagationAxis pInPropagationAxis,
const ipsdk::imaproc::attr::ePropagationDirection pInPropagationDirection 
)

wrapper function for Computes the shortest path from one border to its opposite, given distance ponderation map.

Exceptions
ipsdk::processor::IPSDKBaseProcessingExceptionon failure

◆ ridgeLine3dImg() [2/8]

IPSDKIPLADVANCEDMORPHOLOGY_API ipsdk::imaproc::attr::RidgeLine3dResult ipsdk::imaproc::advmorpho::ridgeLine3dImg ( const ipsdk::image::ImageConstPtr pInImg3d,
const ipsdk::image::ImageConstPtr pInOptMaskImg,
const ipsdk::imaproc::attr::ePropagationAxis pInPropagationAxis,
const ipsdk::imaproc::attr::ePropagationDirection pInPropagationDirection 
)

wrapper function for Computes the shortest path from one border to its opposite, given distance ponderation map.

Exceptions
ipsdk::processor::IPSDKBaseProcessingExceptionon failure

◆ ridgeLine3dImg() [3/8]

IPSDKIPLADVANCEDMORPHOLOGY_API ipsdk::imaproc::attr::Voxels3dPtr ipsdk::imaproc::advmorpho::ridgeLine3dImg ( const ipsdk::image::ImageConstPtr pInImg3d,
const ipsdk::imaproc::attr::ePropagationAxis pInPropagationAxis,
const ipsdk::imaproc::attr::ePropagationDirection pInPropagationDirection,
const ipsdk::image::ImagePtr pOutShortestPathImg,
const ipsdk::image::ImagePtr pOutDistanceMap,
const ipsdk::image::ImagePtr pOutPathMap 
)

wrapper function for Computes the shortest path from one border to its opposite, given distance ponderation map.

Exceptions
ipsdk::processor::IPSDKBaseProcessingExceptionon failure

◆ ridgeLine3dImg() [4/8]

IPSDKIPLADVANCEDMORPHOLOGY_API ipsdk::imaproc::attr::RidgeLine3dResult ipsdk::imaproc::advmorpho::ridgeLine3dImg ( const ipsdk::image::ImageConstPtr pInImg3d,
const ipsdk::imaproc::attr::ePropagationAxis pInPropagationAxis,
const ipsdk::imaproc::attr::ePropagationDirection pInPropagationDirection,
const ipsdk::ipUInt32  nbIter 
)

wrapper function for Computes the shortest path from one border to its opposite, given distance ponderation map.

Exceptions
ipsdk::processor::IPSDKBaseProcessingExceptionon failure

◆ ridgeLine3dImg() [5/8]

IPSDKIPLADVANCEDMORPHOLOGY_API ipsdk::imaproc::attr::RidgeLine3dResult ipsdk::imaproc::advmorpho::ridgeLine3dImg ( const ipsdk::image::ImageConstPtr pInImg3d,
const ipsdk::image::ImageConstPtr pInOptMaskImg,
const ipsdk::imaproc::attr::ePropagationAxis pInPropagationAxis,
const ipsdk::imaproc::attr::ePropagationDirection pInPropagationDirection,
const ipsdk::ipUInt32  nbIter 
)

wrapper function for Computes the shortest path from one border to its opposite, given distance ponderation map.

Exceptions
ipsdk::processor::IPSDKBaseProcessingExceptionon failure

◆ ridgeLine3dImg() [6/8]

IPSDKIPLADVANCEDMORPHOLOGY_API ipsdk::imaproc::attr::Voxels3dPtr ipsdk::imaproc::advmorpho::ridgeLine3dImg ( const ipsdk::image::ImageConstPtr pInImg3d,
const ipsdk::image::ImageConstPtr pInOptMaskImg,
const ipsdk::imaproc::attr::ePropagationAxis pInPropagationAxis,
const ipsdk::imaproc::attr::ePropagationDirection pInPropagationDirection,
const ipsdk::image::ImagePtr pOutShortestPathImg,
const ipsdk::image::ImagePtr pOutDistanceMap,
const ipsdk::image::ImagePtr pOutPathMap 
)

wrapper function for Computes the shortest path from one border to its opposite, given distance ponderation map.

Exceptions
ipsdk::processor::IPSDKBaseProcessingExceptionon failure

◆ ridgeLine3dImg() [7/8]

IPSDKIPLADVANCEDMORPHOLOGY_API ipsdk::imaproc::attr::Voxels3dPtr ipsdk::imaproc::advmorpho::ridgeLine3dImg ( const ipsdk::image::ImageConstPtr pInImg3d,
const ipsdk::imaproc::attr::ePropagationAxis pInPropagationAxis,
const ipsdk::imaproc::attr::ePropagationDirection pInPropagationDirection,
const ipsdk::ipUInt32  nbIter,
const ipsdk::image::ImagePtr pOutShortestPathImg,
const ipsdk::image::ImagePtr pOutDistanceMap,
const ipsdk::image::ImagePtr pOutPathMap 
)

wrapper function for Computes the shortest path from one border to its opposite, given distance ponderation map.

Exceptions
ipsdk::processor::IPSDKBaseProcessingExceptionon failure

◆ ridgeLine3dImg() [8/8]

IPSDKIPLADVANCEDMORPHOLOGY_API ipsdk::imaproc::attr::Voxels3dPtr ipsdk::imaproc::advmorpho::ridgeLine3dImg ( const ipsdk::image::ImageConstPtr pInImg3d,
const ipsdk::image::ImageConstPtr pInOptMaskImg,
const ipsdk::imaproc::attr::ePropagationAxis pInPropagationAxis,
const ipsdk::imaproc::attr::ePropagationDirection pInPropagationDirection,
const ipsdk::ipUInt32  nbIter,
const ipsdk::image::ImagePtr pOutShortestPathImg,
const ipsdk::image::ImagePtr pOutDistanceMap,
const ipsdk::image::ImagePtr pOutPathMap 
)

wrapper function for Computes the shortest path from one border to its opposite, given distance ponderation map.

Exceptions
ipsdk::processor::IPSDKBaseProcessingExceptionon failure

◆ ridgeLine3dImg_multiSlice() [1/4]

IPSDKIPLADVANCEDMORPHOLOGY_API ipsdk::imaproc::attr::PlanIndexedVoxels3dPtr ipsdk::imaproc::advmorpho::ridgeLine3dImg_multiSlice ( const ipsdk::image::ImageConstPtr pInImg3d,
const ipsdk::imaproc::attr::ePropagationAxis pInPropagationAxis,
const ipsdk::imaproc::attr::ePropagationDirection pInPropagationDirection,
const ipsdk::image::ImagePtr pOutShortestPathImg,
const ipsdk::image::ImagePtr pOutDistanceMap,
const ipsdk::image::ImagePtr pOutPathMap 
)

wrapper function for Computes the shortest path from one border to its opposite, given distance ponderation map.

Exceptions
ipsdk::processor::IPSDKBaseProcessingExceptionon failure

◆ ridgeLine3dImg_multiSlice() [2/4]

IPSDKIPLADVANCEDMORPHOLOGY_API ipsdk::imaproc::attr::PlanIndexedVoxels3dPtr ipsdk::imaproc::advmorpho::ridgeLine3dImg_multiSlice ( const ipsdk::image::ImageConstPtr pInImg3d,
const ipsdk::image::ImageConstPtr pInOptMaskImg,
const ipsdk::imaproc::attr::ePropagationAxis pInPropagationAxis,
const ipsdk::imaproc::attr::ePropagationDirection pInPropagationDirection,
const ipsdk::image::ImagePtr pOutShortestPathImg,
const ipsdk::image::ImagePtr pOutDistanceMap,
const ipsdk::image::ImagePtr pOutPathMap 
)

wrapper function for Computes the shortest path from one border to its opposite, given distance ponderation map.

Exceptions
ipsdk::processor::IPSDKBaseProcessingExceptionon failure

◆ ridgeLine3dImg_multiSlice() [3/4]

IPSDKIPLADVANCEDMORPHOLOGY_API ipsdk::imaproc::attr::PlanIndexedVoxels3dPtr ipsdk::imaproc::advmorpho::ridgeLine3dImg_multiSlice ( const ipsdk::image::ImageConstPtr pInImg3d,
const ipsdk::imaproc::attr::ePropagationAxis pInPropagationAxis,
const ipsdk::imaproc::attr::ePropagationDirection pInPropagationDirection,
const ipsdk::ipUInt32  nbIter,
const ipsdk::image::ImagePtr pOutShortestPathImg,
const ipsdk::image::ImagePtr pOutDistanceMap,
const ipsdk::image::ImagePtr pOutPathMap 
)

wrapper function for Computes the shortest path from one border to its opposite, given distance ponderation map.

Exceptions
ipsdk::processor::IPSDKBaseProcessingExceptionon failure

◆ ridgeLine3dImg_multiSlice() [4/4]

IPSDKIPLADVANCEDMORPHOLOGY_API ipsdk::imaproc::attr::PlanIndexedVoxels3dPtr ipsdk::imaproc::advmorpho::ridgeLine3dImg_multiSlice ( const ipsdk::image::ImageConstPtr pInImg3d,
const ipsdk::image::ImageConstPtr pInOptMaskImg,
const ipsdk::imaproc::attr::ePropagationAxis pInPropagationAxis,
const ipsdk::imaproc::attr::ePropagationDirection pInPropagationDirection,
const ipsdk::ipUInt32  nbIter,
const ipsdk::image::ImagePtr pOutShortestPathImg,
const ipsdk::image::ImagePtr pOutDistanceMap,
const ipsdk::image::ImagePtr pOutPathMap 
)

wrapper function for Computes the shortest path from one border to its opposite, given distance ponderation map.

Exceptions
ipsdk::processor::IPSDKBaseProcessingExceptionon failure