IPSDK  4_1_0_2
IPSDK : Image Processing Software Development Kit

application of a look-up table for each 2d plan of an input image algorithm More...

IPSDKIPLINTENSITYTRANSFORM_API ipsdk::image::ImagePtr ipsdk::imaproc::itrans::lutTransform2dImg (const ipsdk::image::ImageConstPtr &pInImg, const ipsdk::imaproc::attr::IntensityLUTConstPtr &pLut)
 wrapper function for application of a look-up table on an input image More...
 
IPSDKIPLINTENSITYTRANSFORM_API ipsdk::image::ImagePtr ipsdk::imaproc::itrans::lutTransform2dImg (const ipsdk::image::ImageConstPtr &pInImg, const ipsdk::imaproc::attr::PlanIndexedIntensityLUTConstPtr &pPILut)
 wrapper function for application of a look-up table on an input image More...
 
IPSDKIPLINTENSITYTRANSFORM_API void ipsdk::imaproc::itrans::lutTransform2dImg (const ipsdk::image::ImageConstPtr &pInImg, const ipsdk::imaproc::attr::IntensityLUTConstPtr &pLut, const ipsdk::image::ImagePtr &pOutImg)
 wrapper function for application of a look-up table on an input image More...
 
IPSDKIPLINTENSITYTRANSFORM_API void ipsdk::imaproc::itrans::lutTransform2dImg (const ipsdk::image::ImageConstPtr &pInImg, const ipsdk::imaproc::attr::PlanIndexedIntensityLUTConstPtr &pPILut, const ipsdk::image::ImagePtr &pOutImg)
 wrapper function for application of a look-up table on an input image More...
 

Detailed Description

application of a look-up table for each 2d plan of an input image algorithm

If the image is made of one single plan (single 2d grey levels image), the algorithm applies the look-up table provided by the user to the intensities of the image. If the image is multi-sliced (made of several plans, like a single 2d RGB image, for instance, or a sequence image, etc.), a collection of look-up tables (one table per plan) is applied to the intensities of the image.

The look-up table is defined using the ipsdk::imaproc::attr::IntensityLUT data item, that is composed of the following parameters:

Considering, for instance, a single 2d grey levels input image InImg and the lookup table LUT to apply, output image OutImg pixels will equal to:

\[ OutImg(x, y) = \begin{cases} LUT.lookupTable[0], \text{if } InImg(x, y) < LUT.min \\ LUT.lookupTable[(InImg(x, y) - LUT.min) / LUT.binWidth], \text{if } LUT.min \leq InImg(x, y) < LUT.min + len(LUT.lookupTable) \times LUT.binWidth \\ LUT.lookupTable[len(LUT.lookupTable)-1] , \text{if } InImg(x, y) > LUT.min + len(LUT.lookupTable) \times LUT.binWidth \end{cases} \]

Note
If the input image is multi-sliced and the user wants to apply the same lookup table for all the plans of the input image, he can specify one single lookup table as input.

Given the following look-up table :

\[ LUT.min = 150 LUT.binWidth = 1 LUT.lookupTable = [i for i in range(106)] \]

Here is an example of look-up table transformation applied to a 8-bits grey level image :

lutTransformImg.png

In this example, all pixels with an intensity lower than 150 in input image are set to 0 in output image. Other pixels are set to a value that equals to $InImg(x, y)-150$ in output image.

Attributes description

Attribute description for algorithm :

Name ToolTip Default Initializer
ipsdk::imaproc::attr::InImg [Input] image for processing operation X
ipsdk::imaproc::attr::InPIIntensityLUT [Input] Plan indexed collection of intensity look-up tables X
ipsdk::imaproc::attr::OutImg [Output] image for processing operation ipsdk::imaproc::duplicateInOut (_pOutImg, _pInImg)

Global Rule description

Global rule description for algorithm :
ipsdk::imaproc::matchSize (_pInImg,_pOutImg) && 
//ipsdk::processor::If (
 ipsdk::imaproc::is2d (_pInPIIntensityLUT), //
 ipsdk::processor::If (
  ipsdk::imaproc::isGrey (_pInPIIntensityLUT), //
  ipsdk::processor::If (
   ipsdk::imaproc::isSingle (_pInPIIntensityLUT), //
   ipsdk::processor::none (), //
   ipsdk::imaproc::matchImagePlans (_pInPIIntensityLUT,_pInImg,eImagePlansMatchPolicy::eIPMP_T)), //
  ipsdk::processor::If (
   ipsdk::imaproc::isSingle (_pInPIIntensityLUT), //
   ipsdk::imaproc::matchImagePlans (_pInPIIntensityLUT,_pInImg,eImagePlansMatchPolicy::eIPMP_C), //
   ipsdk::imaproc::matchImagePlans (_pInPIIntensityLUT,_pInImg,eImagePlansMatchPolicy::eIPMP_CT))), //
 ipsdk::processor::If (
  ipsdk::imaproc::isGrey (_pInPIIntensityLUT), //
  ipsdk::processor::If (
   ipsdk::imaproc::isSingle (_pInPIIntensityLUT), //
   ipsdk::imaproc::matchImagePlans (_pInPIIntensityLUT,_pInImg,eImagePlansMatchPolicy::eIPMP_Z), //
   ipsdk::imaproc::matchImagePlans (_pInPIIntensityLUT,_pInImg,eImagePlansMatchPolicy::eIPMP_ZT)), //
  ipsdk::processor::If (
   ipsdk::imaproc::isSingle (_pInPIIntensityLUT), //
   ipsdk::imaproc::matchImagePlans (_pInPIIntensityLUT,_pInImg,eImagePlansMatchPolicy::eIPMP_ZC), //
   ipsdk::imaproc::matchImagePlans (_pInPIIntensityLUT,_pInImg,eImagePlansMatchPolicy::eIPMP_ZCT)))),
((ipsdk::imaproc::is2d (_pInPIIntensityLUT) && 
  ipsdk::imaproc::isGrey (_pInPIIntensityLUT) && 
  ipsdk::imaproc::isSingle (_pInPIIntensityLUT)) || 
 ipsdk::imaproc::matchImagePlans (_pInPIIntensityLUT,_pInImg,eImagePlansMatchPolicy::eIPMP_ZCT))

Example of Python code :

Example imports

import PyIPSDK
import PyIPSDK.IPSDKIPLGeometricTransform as gtrans
import PyIPSDK.IPSDKIPLIntensityTransform as itrans
import PyIPSDK.IPSDKIPLGlobalMeasure as glbmsr

Code Example

# opening of input images
inImg = PyIPSDK.loadTiffImageFile(inputImgPath)
lut = PyIPSDK.createIntensityLUT(0, 50, [255-i*50 for i in range(256)])
autoOutImg = itrans.lutTransform2dImg(inImg, lut)

Example of C++ code :

Example informations

Associated library

IPSDKIPLIntensityTransform

Header file

Code Example

// Sample with a generated output image
// ------------------------------------
ImagePtr pAutoOutImg = lutTransform2dImg(pInImg, pLut);
// Sample with a provided output image
// -----------------------------------
lutTransform2dImg(pInImg, pLut, pOutImg);
See also
LUTTransform2dImgLvl1
LUTTransform2dImgLvl2
LUTTransform2dImgLvl3

Function Documentation

◆ lutTransform2dImg() [1/4]

IPSDKIPLINTENSITYTRANSFORM_API ipsdk::image::ImagePtr ipsdk::imaproc::itrans::lutTransform2dImg ( const ipsdk::image::ImageConstPtr pInImg,
const ipsdk::imaproc::attr::IntensityLUTConstPtr pLut 
)

wrapper function for application of a look-up table on an input image

Exceptions
ipsdk::processor::IPSDKBaseProcessingExceptionon failure

◆ lutTransform2dImg() [2/4]

IPSDKIPLINTENSITYTRANSFORM_API ipsdk::image::ImagePtr ipsdk::imaproc::itrans::lutTransform2dImg ( const ipsdk::image::ImageConstPtr pInImg,
const ipsdk::imaproc::attr::PlanIndexedIntensityLUTConstPtr pPILut 
)

wrapper function for application of a look-up table on an input image

Exceptions
ipsdk::processor::IPSDKBaseProcessingExceptionon failure

◆ lutTransform2dImg() [3/4]

IPSDKIPLINTENSITYTRANSFORM_API void ipsdk::imaproc::itrans::lutTransform2dImg ( const ipsdk::image::ImageConstPtr pInImg,
const ipsdk::imaproc::attr::IntensityLUTConstPtr pLut,
const ipsdk::image::ImagePtr pOutImg 
)

wrapper function for application of a look-up table on an input image

Exceptions
ipsdk::processor::IPSDKBaseProcessingExceptionon failure

◆ lutTransform2dImg() [4/4]

IPSDKIPLINTENSITYTRANSFORM_API void ipsdk::imaproc::itrans::lutTransform2dImg ( const ipsdk::image::ImageConstPtr pInImg,
const ipsdk::imaproc::attr::PlanIndexedIntensityLUTConstPtr pPILut,
const ipsdk::image::ImagePtr pOutImg 
)

wrapper function for application of a look-up table on an input image

Exceptions
ipsdk::processor::IPSDKBaseProcessingExceptionon failure