IPSDK 0.2
IPSDK : Image Processing Software Development Kit
shortestPath,shortestPathList = ridgeLine3dImg (inImg3d,inPropagationAxis,inPropagationDirection)
shortestPath,shortestPathList = ridgeLine3dImg (inImg3d,inOptMaskImg,inPropagationAxis,inPropagationDirection)
Voxels3dridgeLine3dImg (inImg3d,inPropagationAxis,inPropagationDirection,outShortestPathImg,outDistanceMap,outPathMap)
shortestPath,shortestPathList = ridgeLine3dImg (inImg3d,inPropagationAxis,inPropagationDirection,nbIter)
shortestPath,shortestPathList = ridgeLine3dImg (inImg3d,inOptMaskImg,inPropagationAxis,inPropagationDirection,nbIter)
Voxels3dridgeLine3dImg (inImg3d,inOptMaskImg,inPropagationAxis,inPropagationDirection,outShortestPathImg,outDistanceMap,outPathMap)
Voxels3dridgeLine3dImg (inImg3d,inPropagationAxis,inPropagationDirection,nbIter,outShortestPathImg,outDistanceMap,outPathMap)
Voxels3dridgeLine3dImg (inImg3d,inOptMaskImg,inPropagationAxis,inPropagationDirection,nbIter,outShortestPathImg,outDistanceMap,outPathMap)

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.

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

Header file

#include <IPSDKIPL/IPSDKIPLAdvancedMorphology/Processor/RidgeLine3dImg/RidgeLine3dImg.h>
#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
RidgeLine3dResult rl3d_res = ridgeLine3dImg(pInImg, ePropagationAxis::ePA_X, ePropagationDirection::ePD_Direct);
// 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);