IPSDK 0.2
IPSDK : Image Processing Software Development Kit
void putROI3dImg (inOutImg,inRoiImg,xOffset,yOffset,zOffset)
void putROI3dImg (inImg,inRoiImg,xOffset,yOffset,zOffset,outImg)

Detailed Description

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

This algorithm to set the the 3d ROI of an image (InImgd3d) with the content of another image (InROIImg3d). The ROI is delimited by a box, defined by the attribute InInputImg3dOffset and by the size of the ROI image.

InImg3d and OutImg have the same type and size
InImg3d and InROIImg3d have the same type, and the size of InROIImg3d cannot exceed the size of InImg3d

On output image, values are given by :

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

,

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

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, PyIPSDK.eTiffDirectoryMode.eTDM_Volume)
# intialization of output image
outGeometry = PyIPSDK.geometry3d(PyIPSDK.eImageBufferType.eIBT_UInt8, 50, 50, 50)
outImg = PyIPSDK.createImage(outGeometry)
# 2d ROI insertion
util.putROI3dImg(inImg, inROIImg, 21, 22, 23, outImg)

Example of C++ code :

Example informations

Header file

#include <IPSDKIPL/IPSDKIPLUtility/Processor/PutROI3dImg/PutROI3dImg.h>

Code Example

// opening input image
ImagePtr pInImg = loadTiffImageFile(inputImgPath, eTiffDirectoryMode::eTDM_Volume);
if(pInImg->getBufferType() != imageBufferType)
pInImg = convertImg(pInImg, imageBufferType);
ImagePtr pInROIImg = loadTiffImageFile(inputROIImgPath, eTiffDirectoryMode::eTDM_Volume);
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
putROI3dImg(pInImg, pInROIImg, inOffsetX, inOffsetY, inOffsetZ, pOutImg);