IPSDK 0.2
IPSDK : Image Processing Software Development Kit
Warping 3d algorithmSee full documentation
imagewarp3dImg (inImg,inWarpMotionTransform3d)
imagewarp3dImg (inImg,inWarpMotionTransform3d,inOptInterpolationPolicy)

Detailed Description

algorithm allowing to apply a motion transformation warping operation on a 3d image

This algorithm allows to apply a motion transformation defined by parameter $InWarpMotionTransform3d$ on an input image $InImg3d$. Available warping transformations are defined by enumerate ipsdk::math::transform::eGeometricTransform3dType.

Interpolation policy used during processing is defined by optional input parameter $InOptInterpolationPolicy$ (see ipsdk::imaproc::attr::eInterpolationPolicy).

On output, algorithm generates requested warped image $OutImg$ and optionally output mask image $OutOptMaskImg$. Size of output image is not ruled :

This process is illustrated in 2d case : see Warping 2d algorithm.

If output image is not provided by user, a default output image size is computed using computeWarpedDefaultSize function.

Here is an example of application of Warp3dImg algorithm on a 3d image in case of a centered rotation :

warp3dImg1.png

Example of Python code :

Example imports

import PyIPSDK
import PyIPSDK.IPSDKIPLGeometricTransform as gtrans

Code Example

# opening of input images
inImg3d = PyIPSDK.loadTiffImageFile(inputImgPath)
# case of a translation transformation
transform1 = PyIPSDK.createWarpMotionTransform3d(PyIPSDK.eGeometricTransform3dType.eGT3DT_Translation,
[10, 30, -7])
outImg1 = gtrans.warp3dImg(inImg3d, transform1)
# case of a rotation transformation with retrieval of output optional mask image
# In this case we compute a suitable output image size and allocate
# output image and output optional mask
transform2 = PyIPSDK.createCenteredRotation(math.pi/7, -math.pi/12, math.pi/6, inImg3d)
outputSizeX, outputSizeY, outputSizeZ = gtrans.computeWarpedDefaultSize(transform2, inImg3d)
outImg2 = PyIPSDK.createImage(PyIPSDK.eImageBufferType.eIBT_UInt16, outputSizeX, outputSizeY, outputSizeZ)
outOptMaskImg2 = PyIPSDK.createImage(PyIPSDK.eImageBufferType.eIBT_Binary, outputSizeX, outputSizeY, outputSizeZ)
gtrans.warp3dImg(inImg3d, transform2, PyIPSDK.eInterpolationPolicy.eIP_Cubic, outImg2, outOptMaskImg2)

Example of C++ code :

Example informations

Header file

#include <IPSDKIPL/IPSDKIPLGeometricTransform/Processor/Warp3dImg/Warp3dImg.h>

Code Example

// opening input image
ImagePtr pInImg3d = loadTiffImageFile(inputImgPath);
// case of a translation transformation
math::transform::Translation3d translation(10, 30, -7);
ImagePtr pOutImg1 = warp3dImg(pInImg3d, pTransform1);
// case of a rotation transformation with retrieval of output optional mask image
// In this case we compute a suitable output image size and allocate
// output image and output optional mask
WarpMotionTransform3dConstPtr pTransform2 = createCenteredRotation(M_PI / 7, -M_PI / 12, M_PI / 6, *pInImg3d);
ipUInt64 outputSizeX, outputSizeY, outputSizeZ;
computeWarpedDefaultSize(*pTransform2, *pInImg3d, outputSizeX, outputSizeY, outputSizeZ);
ImageGeometryPtr pOutGeometry2 = geometry3d(pInImg3d->getBufferType(), outputSizeX, outputSizeY, outputSizeZ);
MemoryImagePtr pOutImg2(boost::make_shared<MemoryImage>());
pOutImg2->init(*pOutGeometry2);
ImageGeometryPtr pOutMaskGeometry2 = geometry3d(eImageBufferType::eIBT_Binary, outputSizeX, outputSizeY, outputSizeZ);
MemoryImagePtr pOutOptMaskImg2(boost::make_shared<MemoryImage>());
pOutOptMaskImg2->init(*pOutMaskGeometry2);
warp3dImg(pInImg3d, pTransform2, eInterpolationPolicy::eIP_Cubic, pOutImg2, pOutOptMaskImg2);