IPSDK  4_1_0_2
IPSDK : Image Processing Software Development Kit

Algorithm allowing to set the the 2d ROI of an image with the content of another image. More...

IPSDKIPLUTILITY_API void ipsdk::imaproc::util::putROI2dImg (const image::ImagePtr &pInOutImg, const image::ImageConstPtr &pInRoiImg, ipUInt64 xOffset, ipUInt64 yOffset)
 wrapper function for 2d ROI insertion algorithm More...
 
IPSDKIPLUTILITY_API void ipsdk::imaproc::util::putROI2dImg (const image::ImageConstPtr &pInImg, const image::ImageConstPtr &pInRoiImg, ipUInt64 xOffset, ipUInt64 yOffset, const image::ImagePtr &pOutImg)
 wrapper function for 2d ROI insertion algorithm More...
 

Detailed Description

Algorithm allowing to set the the 2d ROI of an image with the content of another image.

This algorithm to set the the 2d ROI of an image (InImg) with the content of another image (InROIImg). The ROI is delimited by a rectangle, defined by the attribute InInputImg2dOffset and by the size of the ROI image.

InImg and OutImg have the same type and size
InImg and InROIImg have the same type, and the size of InROIImg cannot exceed the size of InImg

On output image, values are given by :

\[ OutImg[x, y] = \begin{cases} InROIImg[x, y] & \text { if } x-InInputImg2dOffset::XOffset \in [0 .. InROIImgXSize-1] \text { and } y-InInputImg2dOffset::YOffset \in [0 .. InROIImgYSize-1] \\ InImg[x, y] & \text { otherwise} \end{cases} \]

,

with $InROIImgXSize$ and $InROIImgYSize$ the sizes of InROIImg image along x-axis and y-axis, respectively.

An example of 2d ROI extraction is shown below, with the following parameters:

putROI2dImg.png

Attributes description

Attribute description for algorithm :

Name ToolTip Default Initializer
ipsdk::imaproc::attr::InImg [Input] image for processing operation X
ipsdk::imaproc::attr::InROIImg [Input] ROI image for processing operation X
ipsdk::imaproc::attr::InInputImg2dOffset [Input] input image 2d offset X
ipsdk::imaproc::attr::OutImg [Output] image for processing operation duplicateInOut (_pOutImg, _pInImg)

Global Rule description

Global rule description for algorithm :
ipsdk::imaproc::matchSizeAndType (_pInImg,_pOutImg) && 
ipsdk::imaproc::matchBufferType (_pInImg,_pInROIImg) && 
ipsdk::imaproc::matchSize (eMatchImageSizeType::eMIST_ZCT,_pInImg,_pInROIImg) && 
ipsdk::imaproc::customImageProperty (_pInImg,
 ipsdk::imaproc::util::containsROI2d (_pInImg,_pInInputImg2dOffset,_pInROIImg))

Example of Python code :

Example imports

import PyIPSDK
import PyIPSDK.IPSDKIPLUtility as util

Code Example

# opening of input image
inImg = PyIPSDK.loadTiffImageFile(inputImgPath)
inROIImg = PyIPSDK.loadTiffImageFile(inputROIImgPath)
# intialization of output image
outGeometry = PyIPSDK.geometry2d(PyIPSDK.eImageBufferType.eIBT_UInt8, 510, 509)
outImg = PyIPSDK.createImage(outGeometry)
# 2d ROI insertion
util.putROI2dImg(inImg, inROIImg, 400, 401, outImg)

Example of C++ code :

Example informations

Associated library

IPSDKIPLUtility

Header file

Code Example

// opening input image
ImagePtr pInImg = loadTiffImageFile(inputImgPath);
if(pInImg->getBufferType() != imageBufferType)
pInImg = convertImg(pInImg, imageBufferType);
ImagePtr pInROIImg = loadTiffImageFile(inputROIImgPath);
if(pInROIImg->getBufferType() != imageBufferType)
pInROIImg = convertImg(pInROIImg, imageBufferType);
boost::shared_ptr<MemoryImage> pOutImg(boost::make_shared<MemoryImage>());
pOutImg->init(pInImg->getGeometry());
// ROI insertion in image
putROI2dImg(pInImg, pInROIImg, inOffsetX, inOffsetY, pOutImg);
See also
PutROI2dImgLvl1
PutROI2dImgLvl2
PutROI2dImgLvl3

Function Documentation

◆ putROI2dImg() [1/2]

IPSDKIPLUTILITY_API void ipsdk::imaproc::util::putROI2dImg ( const image::ImagePtr pInOutImg,
const image::ImageConstPtr pInRoiImg,
ipUInt64  xOffset,
ipUInt64  yOffset 
)

wrapper function for 2d ROI insertion algorithm

Exceptions
ipsdk::processor::IPSDKBaseProcessingExceptionon failure

◆ putROI2dImg() [2/2]

IPSDKIPLUTILITY_API void ipsdk::imaproc::util::putROI2dImg ( const image::ImageConstPtr pInImg,
const image::ImageConstPtr pInRoiImg,
ipUInt64  xOffset,
ipUInt64  yOffset,
const image::ImagePtr pOutImg 
)

wrapper function for 2d ROI insertion algorithm

Exceptions
ipsdk::processor::IPSDKBaseProcessingExceptionon failure