IPSDK  4_1_0_2
IPSDK : Image Processing Software Development Kit

measure of common statistics indicators in a 3d image (mean, max, etc.) intersected with a mask More...

IPSDKIPLGLOBALMEASURE_API ipsdk::imaproc::attr::StatsResultPtr ipsdk::imaproc::glbmsr::statsMaskMsr3d (const ipsdk::image::ImageConstPtr &pInImg, const ipsdk::image::ImageConstPtr &pInMaskImg)
 wrapper function for measure of common statistics indicators in a 3d image (mean, max, etc.) intersected with a mask More...
 
IPSDKIPLGLOBALMEASURE_API ipsdk::imaproc::attr::PlanIndexedStatsResultPtr ipsdk::imaproc::glbmsr::multiSlice_statsMaskMsr3d (const ipsdk::image::ImageConstPtr &pInImg, const ipsdk::image::ImageConstPtr &pInMaskImg)
 wrapper function for measure of common statistics indicators in a 3d image (mean, max, etc.) intersected with a mask for each 3d plan More...
 

Detailed Description

measure of common statistics indicators in a 3d image (mean, max, etc.) intersected with a mask

For each 3d data of the input image, this algorithm measures common statistic indicators (number of pixels, minimum, maximum, mean and standard deviation) on the set of pixels in the input image whose associated pixel in the mask image has a value that equals to 1.

Like Statistics measurement 3d, two wrappers can be called : the statsMaskMsr3d wrapper is only used to compute the statistic measurements on the whole grey level 3d volume, whereas the multiSlice_statsMaskMsr3d wrapper must be used for more complex data (channel of a color volume, frame in a 3d sequence, or for each channel of each volume of a 3d sequence).

See ipsdk::imaproc::attr::StatsResult for a complete list of image statistic measurements processed by this algorithm.

Attributes description

Attribute description for algorithm :

Name ToolTip Default Initializer
ipsdk::imaproc::attr::InImg3d [Input] 3d image for operation X
ipsdk::imaproc::attr::InMaskImg [Input] Binary image for masking operation X
ipsdk::imaproc::attr::OutPIStatsResult [Output] Plan indexed collection of results for image statistics measure operation ipsdk::imaproc::fromImageButVolume (_pOutPIStatsResult, _pInImg3d)

Global Rule description

Global rule description for algorithm :
ipsdk::imaproc::matchSize (_pInImg3d,_pInMaskImg) && 
ipsdk::imaproc::matchImagePlans (_pOutPIStatsResult,_pInImg3d,eImagePlansMatchPolicy::eIPMP_CT)

Example of Python code :

Example imports

import PyIPSDK
import PyIPSDK.IPSDKIPLBinarization as bin
import PyIPSDK.IPSDKIPLGlobalMeasure as glbmsr

Code Example

# opening of input image
inImg = PyIPSDK.loadTiffImageFile(inputImgPath)
# Mask generation
maskImg = bin.thresholdImg(inImg, 64, 192)
# statistics measurement
statsMsrResult = glbmsr.statsMaskMsr3d(inImg, maskImg)
# retrieve measurement results
mean = statsMsrResult.mean
print("Mean value for image is " + str(mean))

Example of C++ code :

Example informations

Associated library

IPSDKIPLGlobalMeasure

Header file

Code Example

// ------------ Calculation on a mono-slice grey level image ------------ //
// Compute statistics on input image
StatsResultPtr pStatsRes = statsMaskMsr3d(pInImg, pMaskImg);
// Retrieve the results as scalar variables
const ipUInt64 uPixCount = pStatsRes->getValue<StatsResult::PixCount>();
const ipReal64 fSum = pStatsRes->getValue<StatsResult::Sum>();
const ipReal64 fMean = pStatsRes->getValue<StatsResult::Mean>();
const ipReal64 fStdDev = pStatsRes->getValue<StatsResult::StdDev>();
const ipReal64 fMin = pStatsRes->getValue<StatsResult::Min>();
const ipReal64 fMax = pStatsRes->getValue<StatsResult::Max>();
// --------------- Calculation on a multi-slice RGB image -------------- //
// Compute statistics on input image
PlanIndexedStatsResultPtr pStatsRes_multiSlice = multiSlice_statsMaskMsr3d(pInImg_multiSlice, pMaskImg_multiSlice);
// Retrieve the results as scalar variables for the channel 1 (Green color)
const ipUInt64 c = 1;
const ipUInt64 uPixCount_multiSlice = pStatsRes_multiSlice->getValue(0, c, 0).getNode<StatsResult::PixCount>().getValue();
const ipReal64 fSum_multiSlice = pStatsRes_multiSlice->getValue(0, c, 0).getNode<StatsResult::Sum>().getValue();
const ipReal64 fMean_multiSlice = pStatsRes_multiSlice->getValue(0, c, 0).getNode<StatsResult::Mean>().getValue();
const ipReal64 fStdDev_multiSlice = pStatsRes_multiSlice->getValue(0, c, 0).getNode<StatsResult::StdDev>().getValue();
const ipReal64 fMin_multiSlice = pStatsRes_multiSlice->getValue(0, c, 0).getNode<StatsResult::Min>().getValue();
const ipReal64 fMax_multiSlice = pStatsRes_multiSlice->getValue(0, c, 0).getNode<StatsResult::Max>().getValue();
See also
StatsMaskMsr3dLvl1
StatsMaskMsr3dLvl2
StatsMaskMsr3dLvl3

Function Documentation

◆ statsMaskMsr3d()

IPSDKIPLGLOBALMEASURE_API ipsdk::imaproc::attr::StatsResultPtr ipsdk::imaproc::glbmsr::statsMaskMsr3d ( const ipsdk::image::ImageConstPtr pInImg,
const ipsdk::image::ImageConstPtr pInMaskImg 
)

wrapper function for measure of common statistics indicators in a 3d image (mean, max, etc.) intersected with a mask

Exceptions
ipsdk::processor::IPSDKBaseProcessingExceptionon failure

◆ multiSlice_statsMaskMsr3d()

IPSDKIPLGLOBALMEASURE_API ipsdk::imaproc::attr::PlanIndexedStatsResultPtr ipsdk::imaproc::glbmsr::multiSlice_statsMaskMsr3d ( const ipsdk::image::ImageConstPtr pInImg,
const ipsdk::image::ImageConstPtr pInMaskImg 
)

wrapper function for measure of common statistics indicators in a 3d image (mean, max, etc.) intersected with a mask for each 3d plan

Note
This wrapper can be used with multi slice input images to retrieve by slice results
Exceptions
ipsdk::processor::IPSDKBaseProcessingExceptionon failure