IPSDK 0.2
IPSDK : Image Processing Software Development Kit
Counting 3d objectsSee full documentation
scalarcounting3dMsr (inLabelImg3d)

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

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

Header file

#include <IPSDKIPL/IPSDKIPLGlobalMeasure/Processor/Counting3dMsr/Counting3dMsr.h>

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>();