IPSDK 0.2
IPSDK : Image Processing Software Development Kit
Label shape extraction 3dSee full documentation
Shape3dColl = labelShapeExtraction3d (inLabelImg3d)
Shape3dColl = labelShapeExtraction3d (inLabelImg3d,inOptSurfaceExtractionSettings)

Detailed Description

Shape extraction from label 3d image algorithm.

This algorithm allows to extract 3d shapes from a label (see Connected Component 3d) input 3d image. This extraction is a required step to be able to proceed to 3d shapes analysis (Shape Analysis 3d). Shapes extracted with this algorithm are then made of 2 parts:

Here is an example of a 3d shape extraction on our binary test image imageMorphoBin3d6.tif, on which a 3d connected component algorithm has been applied to get the associated label image:

labelShapeExtraction3d.png
Note
: the light blue ellipsoid and the dark blue sphere are drawn transparent, to see respectively the green shape behind the ellipsoid and the two holes inside the sphere.

imageMorphoBin3d6.tif is a 3d binary image (background in black, shapes in white), in which the following shapes were drawn:

Example of Python code :

Example imports

import PyIPSDK
import PyIPSDK.IPSDKIPLAdvancedMorphology as advmorpho
import PyIPSDK.IPSDKIPLShapeSegmentation as shapesegmentation

Code Example

# opening of input image
inImg = PyIPSDK.loadTiffImageFile(inputImgPath)
# connected components analysis
inLabelImg3d = advmorpho.connectedComponent3dImg(inImg)
# label shape extraction computation with fine marching cube step and no mesh simplification
outShape3dColl = shapesegmentation.labelShapeExtraction3d(inLabelImg3d)
# label shape extraction computation with surface extraction parameters with fine marching cube step,
# and mesh simplification
simplifiedSurfaceExtractionSettings = PyIPSDK.createSimplifiedSurfaceExtractionSettings(0.9, 100)
outShape3dCollSimplified = shapesegmentation.labelShapeExtraction3d(inLabelImg3d, simplifiedSurfaceExtractionSettings)
# label shape extraction computation with surface extraction parameters with coarse marching cube step
# and no mesh simplification
coarseSurfaceExtractionSettings = PyIPSDK.createSubSampledSurfaceExtractionSettings(2)
outShape3dCollCoarse = shapesegmentation.labelShapeExtraction3d(inLabelImg3d, coarseSurfaceExtractionSettings)

Example of C++ code :

Example informations

Header file

#include <IPSDKIPL/IPSDKIPLShapeSegmentation/Processor/LabelShapeExtraction3d/LabelShapeExtraction3d.h>

Code Example

// opening input image
ImagePtr pInBinImg3d = loadTiffImageFile(inputBinImgPath, eTiffDirectoryMode::eTDM_Volume);
// connected components analysis
ImagePtr pInLabelImg3d = connectedComponent3dImg(pInBinImg3d);
// create the settings used for the surface extraction with ratio and
// minimum number of triangles for the simplification of mesh
SurfaceExtractionSettingsPtr pSurfaceExtractionSettings =
// extract contours from connected component (label) image
Shape3dCollPtr pOutColl = labelShapeExtraction3d(pInLabelImg3d, pSurfaceExtractionSettings);