IPSDK  4_1_0_2
IPSDK : Image Processing Software Development Kit

Count the number of objects in the 3D input label image. More...

IPSDKIPLGLOBALMEASURE_API ipsdk::ipUInt64 ipsdk::imaproc::glbmsr::counting3dMsr (const ipsdk::image::ImageConstPtr &pInLabelImg3d)
 wrapper function for Count the number of objects in the 3D input label image More...
 
IPSDKIPLGLOBALMEASURE_API ipsdk::imaproc::attr::PlanIndexedIndexableUInt64Ptr ipsdk::imaproc::glbmsr::multiSlice_counting3dMsr (const ipsdk::image::ImageConstPtr &pInLabelImg3d)
 wrapper function for Count the number of objects in the 3D input label image More...
 

Detailed Description

Count the number of objects in the 3D input label image.

This algorithm simply computes the number of objects in the input 3D label image. If an image with 4 or 5 dimensions is provided (i.e. a 3D color or 3D sequence image), the algorithms returns the number of objects for each channel and/or frame of each dimension.

Here is an example of result :

counting3d.png

Attributes description

Attribute description for algorithm :

Name ToolTip Default Initializer
ipsdk::imaproc::attr::InLabelImg3d [Input] label image 3d for processing operation X
ipsdk::imaproc::attr::OutPIIndexableUInt64 [Output] Plan indexed collection of container allowing to create a plan index of a single UInt64 ipsdk::imaproc::fromImageButVolume (_pOutPIIndexableUInt64, _pInLabelImg3d)

Global Rule description

Global rule description for algorithm :
ipsdk::imaproc::matchImagePlans (_pOutPIIndexableUInt64,_pInLabelImg3d,eImagePlansMatchPolicy::eIPMP_CT)

Example of Python code :

Example imports

import PyIPSDK
import PyIPSDK.IPSDKIPLGlobalMeasure as glbmsr

Code Example

# measurement for a single slice
result = glbmsr.counting3dMsr(inLabelImg)
# retrieve measurement results
print("The number of objects is " + str(result))
# measurement for a multi-slice case
planIndexedResult = glbmsr.multiSlice_counting3dMsr(inLabelImg_multiSlice)
# retrieve measurement results
resSlice = PyIPSDK.toPyDict(planIndexedResult)[(0, 0, 1)]
print("The number of objects in the second frame is " + str(resSlice["Value"]))

Example of C++ code :

Example informations

Associated library

IPSDKIPLGlobalMeasure

Header file

Code Example

// -------------------------------------------------------
// Case of monoslice calculation
const ipUInt64 count_monoSlice = counting3dMsr(pLabelImg);
// -------------------------------------------------------
// Case of multislice calculation
const PlanIndexedIndexableUInt64Ptr pPICounts = multiSlice_counting3dMsr(pLabelImg_multiSlice);
const ipUInt64 countAtSlice1 = pPICounts->getValue(0, 0, 1).getValue<IndexableUInt64::Value>();
See also
Counting3dMsrLvl1
Counting3dMsrLvl2

Function Documentation

◆ counting3dMsr()

IPSDKIPLGLOBALMEASURE_API ipsdk::ipUInt64 ipsdk::imaproc::glbmsr::counting3dMsr ( const ipsdk::image::ImageConstPtr pInLabelImg3d)

wrapper function for Count the number of objects in the 3D input label image

Exceptions
ipsdk::processor::IPSDKBaseProcessingExceptionon failure

◆ multiSlice_counting3dMsr()

IPSDKIPLGLOBALMEASURE_API ipsdk::imaproc::attr::PlanIndexedIndexableUInt64Ptr ipsdk::imaproc::glbmsr::multiSlice_counting3dMsr ( const ipsdk::image::ImageConstPtr pInLabelImg3d)

wrapper function for Count the number of objects in the 3D input label image

Exceptions
ipsdk::processor::IPSDKBaseProcessingExceptionon failure