IPSDK  4_1_0_2
IPSDK : Image Processing Software Development Kit

Localy adjust the contrast of an image. More...

IPSDKIPLINTENSITYTRANSFORM_API ipsdk::image::ImagePtr ipsdk::imaproc::itrans::adaptiveContrastEnhancement3dImg (const ipsdk::image::ImageConstPtr &pInImg, const ipUInt32 inHalfKnlSizeX, const ipUInt32 inHalfKnlSizeY, const ipUInt32 inHalfKnlSizeZ, const ipReal64 inArithmeticVal, const ipReal32 inBlendMultiplier)
 wrapper function for Localy adjust the contrast of an image More...
 
IPSDKIPLINTENSITYTRANSFORM_API void ipsdk::imaproc::itrans::adaptiveContrastEnhancement3dImg (const ipsdk::image::ImageConstPtr &pInImg, const ipUInt32 inHalfKnlSizeX, const ipUInt32 inHalfKnlSizeY, const ipUInt32 inHalfKnlSizeZ, const ipReal64 inArithmeticVal, const ipReal32 inBlendMultiplier, const image::ImagePtr &pOutImg)
 wrapper function for Localy adjust the contrast of an image More...
 

Detailed Description

Localy adjust the contrast of an image.

This algorithm computes a new intensity according to its neighbour in order to locally enhance the image contrast.

Each voxel intensity is calculated according to a relative percentage of its neighbourhood intensities. The calculation is comparable to the Contrast Limited Adaptive Histogram Equalization (CLAHE) [1], although it remains much less heavy. Contrary to the CLAHE, it is possible to compute the contrast to each voxel in a reasonable amount of time.

In order to reduce the impact of the noise, a tolerance threshold $InArithmeticVal$ is used to make the algorithm consider that a neighbour has the same intensity than the current voxel if $|InImg[x] - InImg[n]| < InArithmeticVal$, where $x$ is the coordinate of the current voxel, $n$ is the coordinate of its neighbour.

The output intensities may differ a lot from the original images. For this reason, the input image is mixed with the adaptive contrast enhancement result to generate an output looking like the input image. It is possible to tune this effect thanks to the inBlendMultiplier parameter. A blend coefficient of 0 means that the output is the direct result of the enhancement and a blend value of 1 will yield the input image.

Please, see Adaptive Contrast Enhancement 2d for an illustration in 2D.

[1] Zuiderveld, Karel. "Contrast Limited Adaptive Histograph Equalization." Graphic Gems IV. San Diego: Academic Press Professional, 1994. 474-485.

Attributes description

Attribute description for algorithm :

Name ToolTip Default Initializer
ipsdk::imaproc::attr::InImg3d [Input] 3d image for operation X
ipsdk::imaproc::attr::InHalfKnlSizeX [Input] half kernel size along X axis for operation X
ipsdk::imaproc::attr::InHalfKnlSizeY [Input] half kernel size along Y axis for operation X
ipsdk::imaproc::attr::InHalfKnlSizeZ [Input] half kernel size along Z axis for operation X
ipsdk::imaproc::attr::InArithmeticVal [Input] value used for arithmetic operations X
ipsdk::imaproc::attr::InBlendMultiplier [Input] Multiplier value used for image blending operation X
ipsdk::imaproc::attr::OutImg [Output] image for processing operation ipsdk::imaproc::duplicateInOut (_pOutImg, _pInImg3d)

Global Rule description

Global rule description for algorithm :
ipsdk::imaproc::matchSize (_pInImg3d,_pOutImg)

Example of Python code :

Example imports

import PyIPSDK
import PyIPSDK.IPSDKIPLIntensityTransform as itrans

Code Example

# opening of input images
inImg = PyIPSDK.loadTiffImageFile(inputImgPath)
# Set up the parameters
halfKnlSizeX = 15;
halfKnlSizeY = 15;
halfKnlSizeZ = 2;
intensityTolerance = 10;
blendRatio = 0.5;
# computation of image histogram
outImg = itrans.adaptiveContrastEnhancement3dImg(inImg, halfKnlSizeX, halfKnlSizeY, halfKnlSizeZ, intensityTolerance, blendRatio)

Example of C++ code :

Example informations

Associated library

IPSDKIPLIntensityTransform

Header file

Code Example

// Set up the parameters
const ipUInt64 halfKnlSizeX = 15;
const ipUInt64 halfKnlSizeY = 15;
const ipUInt64 halfKnlSizeZ = 2;
const ipReal64 intensityTolerance = 10;
const ipReal64 blendRatio = 0.5;
// Process the image
ImagePtr pOutImg = adaptiveContrastEnhancement3dImg(pInImg, halfKnlSizeX, halfKnlSizeY, halfKnlSizeZ, intensityTolerance, blendRatio);
See also
AdaptiveContrastEnhancement3dImgLvl1
AdaptiveContrastEnhancement3dImgLvl2
AdaptiveContrastEnhancement3dImgLvl3

Function Documentation

◆ adaptiveContrastEnhancement3dImg() [1/2]

IPSDKIPLINTENSITYTRANSFORM_API ipsdk::image::ImagePtr ipsdk::imaproc::itrans::adaptiveContrastEnhancement3dImg ( const ipsdk::image::ImageConstPtr pInImg,
const ipUInt32  inHalfKnlSizeX,
const ipUInt32  inHalfKnlSizeY,
const ipUInt32  inHalfKnlSizeZ,
const ipReal64  inArithmeticVal,
const ipReal32  inBlendMultiplier 
)

wrapper function for Localy adjust the contrast of an image

Exceptions
ipsdk::processor::IPSDKBaseProcessingExceptionon failure

◆ adaptiveContrastEnhancement3dImg() [2/2]

IPSDKIPLINTENSITYTRANSFORM_API void ipsdk::imaproc::itrans::adaptiveContrastEnhancement3dImg ( const ipsdk::image::ImageConstPtr pInImg,
const ipUInt32  inHalfKnlSizeX,
const ipUInt32  inHalfKnlSizeY,
const ipUInt32  inHalfKnlSizeZ,
const ipReal64  inArithmeticVal,
const ipReal32  inBlendMultiplier,
const image::ImagePtr pOutImg 
)

wrapper function for Localy adjust the contrast of an image

Exceptions
ipsdk::processor::IPSDKBaseProcessingExceptionon failure