IPSDK 0.2
IPSDK : Image Processing Software Development Kit
Addition between images with different dimensionsSee full documentation
imagegenericAddImgImg (inImg1,inImg2)

Detailed Description

function for add images with different dimensions

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

The output image values are given by:

\[ OutImg[i] = InImg1[i] + InImg2[i] \]

Here is an example of a generic addition operation, applied to two 8-bits grey level images, the first one is a 3D image (z=3) and the second one is a 2D image :

genericAddImgImg.png

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 addition
outImg = arithm.genericAddImgImg(inImg1, inImg2)

Example of C++ code :

Example informations

Header file

#include <IPSDKIPL/IPSDKIPLArithmetic/Processor/GenericAddImgImg/GenericAddImgImg.h>

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 addition of input images
ImagePtr pOutImgAuto = genericAddImgImg(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 addition of input images
genericAddImgImg(pInImg1, pInImg2, pOutImg);