IPSDK  4_1_0_2
IPSDK : Image Processing Software Development Kit

Look for 3D particular patterns of foreground and background given as structuring elements. More...

IPSDKIPLBASICMORPHOLOGY_API image::ImagePtr ipsdk::imaproc::morpho::hitAndMiss3dImg (const image::ImageConstPtr &pInBinImg3d, const StructuringElementXYZInfoConstPtr &pInForegroundSEXYZ, const StructuringElementXYZInfoConstPtr &pInBackgroundSEXYZ)
 wrapper function for Look for 3D particular patterns of foreground and background given as structuring elements More...
 
IPSDKIPLBASICMORPHOLOGY_API void ipsdk::imaproc::morpho::hitAndMiss3dImg (const image::ImageConstPtr &pInBinImg3d, const StructuringElementXYZInfoConstPtr &pInForegroundSEXYZ, const StructuringElementXYZInfoConstPtr &pInBackgroundSEXYZ, const image::ImagePtr &pOutBinImg)
 wrapper function for Look for 3D particular patterns of foreground and background given as structuring elements More...
 

Detailed Description

Look for 3D particular patterns of foreground and background given as structuring elements.

The Hit and Miss, also known as Hit or Miss, is a binary morphological operation used to find a particular pattern. This algorithm generates a binary image where pixels with the value 1 (or true) match the pattern given by the foreground and background structuring elements.

The foreground structuring element contains relative coordinates in the current pixel neighbourhood whith an intensity of 1, whereas the background structuring element determines the pixels that must have an intensity of 0. If a pixel can indefferently equal 0 or 1, its coordinate is not specified. Obviously, a pixel coordinate can not appear in both structuring elements.

See HitAndMiss2dImg algorithm for 2D examples of the Hit And Miss algorithm.

Attributes description

Attribute description for algorithm :

Name ToolTip Default Initializer
ipsdk::imaproc::attr::InBinImg3d [Input] binary 3d image for processing operation X
ipsdk::imaproc::attr::InSEXYZ1 [Input] first structuring element xyz for processing operation X
ipsdk::imaproc::attr::InSEXYZ2 [Input] second structuring element xyz for processing operation X
ipsdk::imaproc::attr::OutBinImg [Output] binary image for processing operation ipsdk::imaproc::duplicateInOut (_pOutBinImg, _pInBinImg3d)

Global Rule description

Global rule description for algorithm :
ipsdk::imaproc::matchSizeAndType (_pInBinImg3d,_pOutBinImg)

Example of Python code :

Example imports

import PyIPSDK
import PyIPSDK.IPSDKIPLBasicMorphology as morpho

Code Example

# opening of input image
inImg = PyIPSDK.loadTiffImageFile(inputImgPath)
# Fill the structuring element, we want the
# following foreground ('X' are ignored pixels) :
# X X X X
# X 1 1 1
# X 1 1 1
foregroundSE = PyIPSDK.emptySEXYZInfo()
# Fill the structuring element, we want the
# following foreground ('X' are ignored pixels) :
# X X X
# X 1 1
# X 1 1
# Z
foregroundSE.insert(0, 0, 0);
foregroundSE.insert(1, 0, 0);
foregroundSE.insert(0, 1, 0);
foregroundSE.insert(1, 1, 0);
# Fill the structuring element, we want the
# following background ('X' are ignored pixels) :
# 0 0 0
# 0 X X
# 0 X X
backgroundSE = PyIPSDK.emptySEXYZInfo()
# 0 0 0 0 0 0
# 0 0 0 0 X X
# 0 0 0 0 X X
# Z-1 Z
for offsetY in range(-1, 2):
for offsetX in range(-1, 2):
backgroundSE.insert(offsetX, offsetY, -1);
backgroundSE.insert(-1, -1, 0);
backgroundSE.insert(0, -1, 0);
backgroundSE.insert(1, -1, 0);
backgroundSE.insert(-1, 0, 0);
backgroundSE.insert(-1, 1, 0);
# Compute operation on the input image
# With the combination of the 2 structuring elements,
# the algorithm will look for the following pattern
# 0 0 0 0 0 0
# 0 0 0 0 1 1
# 0 0 0 0 1 1
# Z-1 Z
outImg = morpho.hitAndMiss3dImg(inImg, foregroundSE, backgroundSE);

Example of C++ code :

Example informations

Associated library

IPSDKIPLBasicMorphology

Header file

Code Example

// opening input image
ImagePtr pInBinImg = loadTiffImageFile(inputImgPath);
// Create an empty structuring element to describe the desired foreground
// Fill the structuring element, we want the
// following foreground ('X' are ignored pixels) :
// X X X
// X 1 1
// X 1 1
// Z
pForegroundSE->insert(0, 0, 0);
pForegroundSE->insert(1, 0, 0);
pForegroundSE->insert(0, 1, 0);
pForegroundSE->insert(1, 1, 0);
// Create an empty structuring element to describe the desired background
// Fill the structuring element, we want the
// following background ('X' are ignored pixels) :
// 0 0 0 0 0 0
// 0 0 0 0 X X
// 0 0 0 0 X X
// Z-1 Z
for(ipInt32 offsetY = -1; offsetY<=1; ++offsetY)
for(ipInt32 offsetX = -1; offsetX<=1; ++offsetX)
pBackgroundSE->insert(offsetX, offsetY, -1);
pBackgroundSE->insert(-1, -1, 0);
pBackgroundSE->insert(0, -1, 0);
pBackgroundSE->insert(1, -1, 0);
pBackgroundSE->insert(-1, 0, 0);
pBackgroundSE->insert(-1, 1, 0);
// Compute operation on the input image
// With the combination of the 2 structuring elements,
// the algorithm will look for the following pattern
// 0 0 0 0 0 0
// 0 0 0 0 1 1
// 0 0 0 0 1 1
// Z-1 Z
ImagePtr pOutImg = hitAndMiss3dImg(pInBinImg, pForegroundSE, pBackgroundSE);
See also
HitAndMiss3dImgLvl1
HitAndMiss3dImgLvl2
HitAndMiss3dImgLvl3

Function Documentation

◆ hitAndMiss3dImg() [1/2]

IPSDKIPLBASICMORPHOLOGY_API image::ImagePtr ipsdk::imaproc::morpho::hitAndMiss3dImg ( const image::ImageConstPtr pInBinImg3d,
const StructuringElementXYZInfoConstPtr pInForegroundSEXYZ,
const StructuringElementXYZInfoConstPtr pInBackgroundSEXYZ 
)

wrapper function for Look for 3D particular patterns of foreground and background given as structuring elements

Exceptions
ipsdk::processor::IPSDKBaseProcessingExceptionon failure

◆ hitAndMiss3dImg() [2/2]

IPSDKIPLBASICMORPHOLOGY_API void ipsdk::imaproc::morpho::hitAndMiss3dImg ( const image::ImageConstPtr pInBinImg3d,
const StructuringElementXYZInfoConstPtr pInForegroundSEXYZ,
const StructuringElementXYZInfoConstPtr pInBackgroundSEXYZ,
const image::ImagePtr pOutBinImg 
)

wrapper function for Look for 3D particular patterns of foreground and background given as structuring elements

Exceptions
ipsdk::processor::IPSDKBaseProcessingExceptionon failure