IPSDK  4_1_0_2
IPSDK : Image Processing Software Development Kit
Division between images with different dimensions

functions for divide images with different dimensions More...

IPSDKIPLARITHMETIC_API void ipsdk::imaproc::arithm::genericDivideImgImg (const image::ImageConstPtr &pInImg1, const image::ImageConstPtr &pInImg2, const image::ImagePtr &pOutImg)
 wrapper function for functions for divide images with different dimensions More...
 
IPSDKIPLARITHMETIC_API image::ImagePtr ipsdk::imaproc::arithm::genericDivideImgImg (const image::ImageConstPtr &pInImg1, const image::ImageConstPtr &pInImg2)
 wrapper function for functions for divide images with different dimensions More...
 

Detailed Description

functions for divide images with different dimensions

Division of 2 images with different dimensions (volume with plan, volume color with volume...). The image with the highest dimensions is always have to be the first one.

The output image values are given by:

\[ OutImg[i] = \begin{cases} \dfrac{InImg1[i]}{InImg2[i]}, & \text{if }InImg2[i] \neq 0 \\ 0, & \text{otherwise} \end{cases} \]

See Addition between images with different dimensions for an illustrated example.

Attributes description

Attribute description for algorithm :

Name ToolTip Default Initializer
ipsdk::imaproc::attr::InImg1 [Input] First image for processing operation X
ipsdk::imaproc::attr::InImg2 [Input] Second image for processing operation X
ipsdk::imaproc::attr::OutImg [Output] image for processing operation promoteBinary (_pOutImg, _pInImg1, _pInImg2, ipsdk::imaproc::ePromoteBinaryType::ePBT_Upper, true)

Global Rule description

Global rule description for algorithm :
(ipsdk::processor::If (
  ipsdk::imaproc::is2d (_pInImg2),
  ipsdk::processor::If (
   ipsdk::imaproc::isSequence (_pInImg2),
   ipsdk::processor::If (
    ipsdk::imaproc::isGrey (_pInImg2),
    (ipsdk::imaproc::matchSize (eMatchImageSizeType::eMIST_2d,_pInImg1,_pInImg2) && 
     ipsdk::imaproc::matchSize (eMatchImageSizeType::eMIST_T,_pInImg1,_pInImg2)),
    ipsdk::processor::Not (
     ipsdk::processor::none ())),
   ipsdk::processor::If (
    ipsdk::imaproc::isGrey (_pInImg2),
    ipsdk::imaproc::matchSize (eMatchImageSizeType::eMIST_2d,_pInImg1,_pInImg2),
    (ipsdk::imaproc::matchSize (eMatchImageSizeType::eMIST_2d,_pInImg1,_pInImg2) && 
     ipsdk::imaproc::matchSize (eMatchImageSizeType::eMIST_C,_pInImg1,_pInImg2)))),
  ipsdk::processor::If (
   ipsdk::imaproc::isSingle (_pInImg2),
   ipsdk::processor::If (
    ipsdk::imaproc::isGrey (_pInImg2),
    ipsdk::imaproc::matchSize (eMatchImageSizeType::eMIST_3d,_pInImg1,_pInImg2),
    ipsdk::imaproc::matchSize (eMatchImageSizeType::eMIST_XYZC,_pInImg1,_pInImg2)),
   ipsdk::processor::Not (
    ipsdk::processor::none ()))) && 
 ipsdk::imaproc::matchSize (_pInImg1,_pOutImg))

Example of Python code :

Example imports

import PyIPSDK
import PyIPSDK.IPSDKIPLArithmetic as arithm

Code Example

# opening input images
inGeometry = PyIPSDK.geometry2d(PyIPSDK.eImageBufferType.eIBT_UInt8, 510, 509)
inImg1 = PyIPSDK.loadTiffImageFile(inputImg1Path)
inImg2 = PyIPSDK.loadTiffImageFile(inputImg2Path)
# images division
outImg = arithm.genericDivideImgImg(inImg1, inImg2)

Example of C++ code :

Example informations

Associated library

IPSDKIPLArithmetic

Header file

Code Example

// open input images with different dimensions (3d and 2d in this case)
ImageGeometryPtr pInputImageGeometry1 = geometry3d(inType, sizeX, sizeY, sizeZ);
ImagePtr pInImg1 = loadRawImageFile(in1Path, *pInputImageGeometry1);
ImageGeometryPtr pInputImageGeometry2 = geometry2d(inType, sizeX, sizeY);
ImagePtr pInImg2 = loadRawImageFile(in2Path, *pInputImageGeometry2);
// Compute division of input images
ImagePtr pOutImgAuto = genericDivideImgImg(pInImg1, pInImg2);
// Or create output image with the same dimensions than the first image
ImageGeometryPtr pOutputImageGeometry = geometry3d(inType, sizeX, sizeY, sizeZ);
boost::shared_ptr<MemoryImage> pOutImg(boost::make_shared<MemoryImage>());
pOutImg->init(*pOutputImageGeometry);
// compute division of input images
genericDivideImgImg(pInImg1, pInImg2, pOutImg);
See also
GenericDivideImgImgLvl1

Function Documentation

◆ genericDivideImgImg() [1/2]

IPSDKIPLARITHMETIC_API void ipsdk::imaproc::arithm::genericDivideImgImg ( const image::ImageConstPtr pInImg1,
const image::ImageConstPtr pInImg2,
const image::ImagePtr pOutImg 
)

wrapper function for functions for divide images with different dimensions

Exceptions
ipsdk::processor::IPSDKBaseProcessingExceptionon failure

◆ genericDivideImgImg() [2/2]

IPSDKIPLARITHMETIC_API image::ImagePtr ipsdk::imaproc::arithm::genericDivideImgImg ( const image::ImageConstPtr pInImg1,
const image::ImageConstPtr pInImg2 
)

wrapper function for functions for divide images with different dimensions

Exceptions
ipsdk::processor::IPSDKBaseProcessingExceptionon failure