IPSDK  4_1_0_2
IPSDK : Image Processing Software Development Kit

finds the local extrema in an image More...

IPSDKIPLFEATUREDETECTION_API ipsdk::imaproc::attr::Pixels2dPtr ipsdk::imaproc::fd::extractLocalExtrema2d (const image::ImageConstPtr &pInImg, const ipsdk::ipUInt32 inFeaturesDistX, const ipsdk::ipUInt32 inFeaturesDistY)
 wrapper function for extraction of local extrema (minima, maxima, or both of them) in an image This wrapper must be used with mono slice (sizeZ=sizeC=sizeT=1) input images More...
 
IPSDKIPLFEATUREDETECTION_API ipsdk::imaproc::attr::Pixels2dPtr ipsdk::imaproc::fd::extractLocalExtrema2d (const image::ImageConstPtr &pInImg, const ipsdk::ipUInt32 inFeaturesDistX, const ipsdk::ipUInt32 inFeaturesDistY, const ipsdk::imaproc::attr::LocalExtremaConfigConstPtr &localExtremaConfig)
 wrapper function for extraction of local extrema (minima, maxima, or both of them) in an image This wrapper must be used with mono slice (sizeZ=sizeC=sizeT=1) input images More...
 
IPSDKIPLFEATUREDETECTION_API ipsdk::imaproc::attr::PlanIndexedPixels2dPtr ipsdk::imaproc::fd::multiSlice_extractLocalExtrema2d (const image::ImageConstPtr &pInImg, const ipsdk::ipUInt32 inFeaturesDistX, const ipsdk::ipUInt32 inFeaturesDistY)
 multi slices version of wrapper function for extraction of local extrema (minima, maxima, or both of them) in an image This wrapper can be used with multi slice input images More...
 
IPSDKIPLFEATUREDETECTION_API ipsdk::imaproc::attr::PlanIndexedPixels2dPtr ipsdk::imaproc::fd::multiSlice_extractLocalExtrema2d (const image::ImageConstPtr &pInImg, const ipsdk::ipUInt32 inFeaturesDistX, const ipsdk::ipUInt32 inFeaturesDistY, const ipsdk::imaproc::attr::LocalExtremaConfigConstPtr &localExtremaConfig)
 multi slices version of wrapper function for extraction of local extrema (minima, maxima, or both of them) in an image This wrapper can be used with multi slice input images More...
 

Detailed Description

finds the local extrema in an image

Given an input 2d gray level image, and depending on the parameters $LocalExtremaConfig$, set by the user, the algorithm returns:

For non strict local extrema calculation, an extremum can belong to a plateau. In this case, the algorithm generally selects the first pixel of the first line of the plateau. However, several local extrema can be found in the same plateau. The following figure illustrates an example of plateau where more than one local extremum is found. The plateau is represented by black pixels and the extrema selected are colored in red in the right figure.

illustrationExtrema2d.png

Two wrappers can be called : the extractLocalExtrema2d wrapper is only used to compute the extrema extraction on a grey level 2d images, whereas the multiSlice_extractLocalExtrema2d wrapper must be used for more complex data (volume, sequence and/or color).

The user may handle this behaviour correctly to analyze the obtained results.

Attributes description

Attribute description for algorithm :

Name ToolTip Default Initializer
ipsdk::imaproc::attr::InImg [Input] image for processing operation X
ipsdk::imaproc::attr::InFeaturesDistX [Input] distance between detected features along x axis (tchebychev distance) X
ipsdk::imaproc::attr::InFeaturesDistY [Input] distance between detected features along y axis (tchebychev distance) X
ipsdk::imaproc::attr::InOptLocalExtremaConfig [Input Optional] Attribute for local extrema calculation configuration X
ipsdk::imaproc::attr::OutPIPixels2d [Output] plan indexed collection of positions and intensities of 2d pixels ipsdk::imaproc::fromImage (_pOutPIPixels2d, _pInImg)

Global Rule description

Global rule description for algorithm :
ipsdk::imaproc::matchImagePlans (_pOutPIPixels2d,_pInImg,eImagePlansMatchPolicy::eIPMP_ZCT)

Example of Python code :

Example imports

import PyIPSDK
import PyIPSDK.IPSDKIPLFeatureDetection as fd

Code Example

# opening of input image
inImg = PyIPSDK.loadTiffImageFile(inputImgPath)
# half size neighbourhood definition
halfSizeKnlX = 1
halfSizeKnlY = 1
# local extrema configuration definition
threshold = -30
nbTotPoints = 2000
localExtremaConfig = PyIPSDK.createLocalExtremaConfig(PyIPSDK.eLocalExtremumType.eLET_StrictMax, threshold, nbTotPoints)
# local extrema computation
outPixels2d = fd.extractLocalExtrema2d(inImg, halfSizeKnlX, halfSizeKnlY, localExtremaConfig)
# retrieve coordinates of maximum detected extrema
maxPixel2d = PyIPSDK.toPyDict(outPixels2d)['Coll'][0]
print("Maximum extrema value " + str(maxPixel2d['Intensity'] ) + " found on coordinates x=" + str(maxPixel2d['X'] ) + " and y=" + str(maxPixel2d['Y'] ))

Example of C++ code :

Example informations

Associated library

IPSDKIPLFeatureDetection

Header file

Code Example

// ------------ Calculation on a mono-slice grey level image ------------ //
// Create the local extrema configuration instance, specifying the local extremum type,
// the threshold and the number of total points. All these parameters are optional
LocalExtremaConfigPtr pLocalExtremaConfig = createLocalExtremaConfig(localExtremumType, threshold, nbTotPoints);
// Load the input image
ImagePtr pInImg = loadTiffImageFile(inImgFilePath);
// Extrcat the local extrema, in a given neighbourhood
Pixels2dPtr pExtremaColl = extractLocalExtrema2d(pInImg, halfKnlSizeX, halfKnlSizeY, pLocalExtremaConfig);
// Retrieve the extrema collection
const std::vector< boost::shared_ptr<Pixel2d> > extremaColl = pExtremaColl->getNodeColl<Pixels2d::Coll>();
const ipUInt64 nbPoints = extremaColl.size();
// ------------ Calculation on a multi-slice grey level image ------------ //
// Extrcat the local extrema, in a given neighbourhood
PlanIndexedPixels2dPtr pExtremaColl_multiSlice = multiSlice_extractLocalExtrema2d(pInImg_multiSlice, halfKnlSizeX, halfKnlSizeY, pLocalExtremaConfig);
// Retrieve the extrema collection for the frame 2, the channel 0 and the slice 1
const std::vector< boost::shared_ptr<Pixel2d> > extremaColl_multiSlice = pExtremaColl_multiSlice->getValue(1, 0, 2).getNodeColl<Pixels2d::Coll>();
See also
ExtractLocalExtrema2dLvl1
ExtractLocalExtrema2dLvl2
ExtractLocalExtrema2dLvl3

Function Documentation

◆ extractLocalExtrema2d() [1/2]

IPSDKIPLFEATUREDETECTION_API ipsdk::imaproc::attr::Pixels2dPtr ipsdk::imaproc::fd::extractLocalExtrema2d ( const image::ImageConstPtr pInImg,
const ipsdk::ipUInt32  inFeaturesDistX,
const ipsdk::ipUInt32  inFeaturesDistY 
)

wrapper function for extraction of local extrema (minima, maxima, or both of them) in an image This wrapper must be used with mono slice (sizeZ=sizeC=sizeT=1) input images

Exceptions
ipsdk::processor::IPSDKBaseProcessingExceptionon failure

◆ multiSlice_extractLocalExtrema2d() [1/2]

IPSDKIPLFEATUREDETECTION_API ipsdk::imaproc::attr::PlanIndexedPixels2dPtr ipsdk::imaproc::fd::multiSlice_extractLocalExtrema2d ( const image::ImageConstPtr pInImg,
const ipsdk::ipUInt32  inFeaturesDistX,
const ipsdk::ipUInt32  inFeaturesDistY 
)

multi slices version of wrapper function for extraction of local extrema (minima, maxima, or both of them) in an image This wrapper can be used with multi slice input images

Exceptions
ipsdk::processor::IPSDKBaseProcessingExceptionon failure

◆ extractLocalExtrema2d() [2/2]

IPSDKIPLFEATUREDETECTION_API ipsdk::imaproc::attr::Pixels2dPtr ipsdk::imaproc::fd::extractLocalExtrema2d ( const image::ImageConstPtr pInImg,
const ipsdk::ipUInt32  inFeaturesDistX,
const ipsdk::ipUInt32  inFeaturesDistY,
const ipsdk::imaproc::attr::LocalExtremaConfigConstPtr localExtremaConfig 
)

wrapper function for extraction of local extrema (minima, maxima, or both of them) in an image This wrapper must be used with mono slice (sizeZ=sizeC=sizeT=1) input images

Exceptions
ipsdk::processor::IPSDKBaseProcessingExceptionon failure

◆ multiSlice_extractLocalExtrema2d() [2/2]

IPSDKIPLFEATUREDETECTION_API ipsdk::imaproc::attr::PlanIndexedPixels2dPtr ipsdk::imaproc::fd::multiSlice_extractLocalExtrema2d ( const image::ImageConstPtr pInImg,
const ipsdk::ipUInt32  inFeaturesDistX,
const ipsdk::ipUInt32  inFeaturesDistY,
const ipsdk::imaproc::attr::LocalExtremaConfigConstPtr localExtremaConfig 
)

multi slices version of wrapper function for extraction of local extrema (minima, maxima, or both of them) in an image This wrapper can be used with multi slice input images

Exceptions
ipsdk::processor::IPSDKBaseProcessingExceptionon failure