IPSDK 4.1.0.2
IPSDK : Image Processing Software Development Kit
Hysteresis Threshold 3d
imagedarkHysteresisThreshold3dImg (inImg3d,highSeedThreshold,highPropagationThreshold)
imagelightHysteresisThreshold3dImg (inImg3d,lowSeedThreshold,lowPropagationThreshold)
imagehysteresisThreshold3dImg (inImg3d,lowSeedThreshold,highSeedThreshold,lowPropagationThreshold,highPropagationThreshold)

Detailed Description

Apply hysteresis thresholding to a 3d image.

Hysteresis threshold algorithm applies two thresholds $T_S$ and $T_P$ on the output image. $T_S$ is the most restrictive threshold and yields a seed image $I_S$, used to propagate the marked features in $I_P$, obtained by thresholding the input image by $T_P$. This algorithm is commonly used in edge detection such as Canny edge detector.

The aim of this threshold is to preserve the features in $I_P$ containing a seed in $I_S$.

The algorithm needs 4 thresholds: the minimum and maximum thresholds $T_S^{Min}$ and $T_S^{Max}$ to compute the seed image $I_S$ and the minimum and maximum thresholds $T_P^{Min}$ and $T_P^{Max}$ to compute the image $I_P$, used for the propagation.

\begin{eqnarray*} I_S[i] & = & \begin{cases} 1, & \text{if } T_S^{Min} \leq InImg[i] \leq T_S^{Max} \\ 0, & \text{otherwise} \end{cases} \\ I_P[i] & = & \begin{cases} 1, & \text{if } T_P^{Min} \leq InImg[i] \leq T_P^{Max} \\ 0, & \text{otherwise} \end{cases} \end{eqnarray*}

To simplify the algorithm parametrization, several wrappers are defined to apply this threshold:

See Hysteresis Threshold 2d for an example of hysteresis threshold.

Example of Python code :

Example imports

import PyIPSDK
import PyIPSDK.IPSDKIPLBinarization as bin

Code Example

# opening of input images
inImg = PyIPSDK.loadTiffImageFile(inputImgPath)
# threshold computation
outImg = bin.hysteresisThreshold3dImg(inImg, 100, 127, 64, 127)

Example of C++ code :

Example informations

Header file

#include <IPSDKIPL/IPSDKIPLBinarization/Processor/HysteresisThreshold3dImg/HysteresisThreshold3dImg.h>

Code Example

// Compute the dark hysteresis threshold
// --------------------------------------
ImagePtr pOutImg_dark = darkHysteresisThreshold3dImg(pInImg, threshSeedMax_dark, threshPropagationMax_dark);
// Compute the light hysteresis threshold
// --------------------------------------
ImagePtr pOutImg_light = lightHysteresisThreshold3dImg(pInImg, threshSeedMin_light, threshPropagationMin_light);
// Compute the hysteresis threshold with
// custom params and provided ouput image
// --------------------------------------
const ipUInt64 sizeX = pInImg->getSizeX();
const ipUInt64 sizeY = pInImg->getSizeY();
const ipUInt64 sizeZ = pInImg->getSizeZ();
// Create output image
ImageGeometryPtr pOutputImageGeometry = geometry3d(eImageBufferType::eIBT_Binary, sizeX, sizeY, sizeZ);
boost::shared_ptr<MemoryImage> pOutImg(boost::make_shared<MemoryImage>());
pOutImg->init(*pOutputImageGeometry);
// Compute the threshold
hysteresisThreshold3dImg(pInImg, threshSeedMin, threshSeedMax, threshPropagationMin, threshPropagationMax, neighbourhood3d, pOutImg);