scalar = | counting3dMsr (inLabelImg3d) |
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 :
Example of Python code :
Example imports
import PyIPSDK
import PyIPSDK.IPSDKIPLGlobalMeasure as glbmsr
Code Example
result = glbmsr.counting3dMsr(inLabelImg)
print("The number of objects is " + str(result))
planIndexedResult = glbmsr.multiSlice_counting3dMsr(inLabelImg_multiSlice)
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
const ipUInt64 count_monoSlice = counting3dMsr(pLabelImg);
const PlanIndexedIndexableUInt64Ptr pPICounts = multiSlice_counting3dMsr(pLabelImg_multiSlice);
const ipUInt64 countAtSlice1 = pPICounts->getValue(0, 0, 1).getValue<IndexableUInt64::Value>();