IPSDK 0.2
IPSDK : Image Processing Software Development Kit
Shape Filtering 2dSee full documentation
imageshapeFiltering2dImg (inBinLabImg,inFilterFormula)
imageshapeFiltering2dImg (inBinLabImg,inGreyMsrImg,inFilterFormula)
imageshapeFiltering2dImg (inBinLabImg,inFilterFormula,inOptMeasureInfoSet2d)
imageshapeFiltering2dImg (inBinLabImg,inGreyMsrImg,inFilterFormula,inOptMeasureInfoSet2d)

Detailed Description

Shape 2d filtering algorithm.

This algorithm allows to filter an input binary or label image with respect to a shape analysis measure formula.

OutImg output image type is given by InBinLabImg input image type which can be a binary or a label image.

This is a packaged algorithm which can be decomposed into the following steps :

Additional measures definition can be provided using InOptMeasureInfoSet2d attribute. This allows to create user custom parametred measures (such as histogram quantile which depends on a target quantile value).

Here is an example of shape 2d filtering operation where all small shapes are removed (used formula : $Area2dMsr > 1000$)

shapeFiltering2dImg1.png

In this case input binary image (on the left) is filtered using a geometric criterion. Intermediate label (connected components) image and measurement results are displayed (on center) before final binary image result (on the right).

Here is an example of shape 2d filtering operation using an intensity criterion (used formula : $MeanMsr{green} > 100$).

shapeFiltering2dImg2.png

In this case input binary image (on the left) is filtered using a grey image (on the left) as analysis and measurement support. Intermediate label (connected components) image and measurement results are displayed (on center) before final binary image result (on the right).

Example of Python code :

Example imports

import PyIPSDK
import PyIPSDK.IPSDKIPLShapeAnalysis as shapeanalysis

Code Example

# opening binary input image
inBinImg = PyIPSDK.loadTiffImageFile(inputBinImgPath)
# process of shape filtering in simple case
outImg1 = shapeanalysis.shapeFiltering2dImg(inBinImg, "Area2dMsr > 1000")
# opening grey level input image
inGreyImg = PyIPSDK.loadTiffImageFile(inputGreyImgPath)
# process of shape filtering with custom measure parameters
measureInfoSet = PyIPSDK.createMeasureInfoSet2d()
PyIPSDK.createMeasureInfo(measureInfoSet, "MyQuantileMsr", "HistogramQuantileMsr", shapeanalysis.createHistogramQuantileMsrParamsBinWidth(1.0, 75.0))
outImg2 = shapeanalysis.shapeFiltering2dImg(inBinImg, inGreyImg, "MyQuantileMsr > 170", measureInfoSet)

Example of C++ code :

Example informations

Header file

#include <IPSDKIPL/IPSDKIPLShapeAnalysis/Processor/ShapeFiltering2dImg/ShapeFiltering2dImg.h>

Code Example

// opening binary input image
ImagePtr pInBinImg2d = loadTiffImageFile(inputBinImgPath);
// process of shape filtering in simple case
const std::string formulaStr1 = "Area2dMsr > 1000";
ImagePtr pOutImg1 = shapeFiltering2dImg(pInBinImg2d, formulaStr1);
// opening grey level input image
ImagePtr pInGreyImg2d = loadTiffImageFile(inputGreyImgPath);
// process of shape filtering with custom measure parameters
MeasureInfoSetPtr pMeasureInfoSet = MeasureInfoSet::create2dInstance();
createMeasureInfo(pMeasureInfoSet, "MyQuantileMsr", "HistogramQuantileMsr", createHistogramQuantileMsrParamsBinWidth(1.0, 75.0));
const std::string formulaStr2 = "MyQuantileMsr > 170";
ImagePtr pOutImg2 = shapeFiltering2dImg(pInBinImg2d, pInGreyImg2d, formulaStr2, pMeasureInfoSet);