algorithm allowing to apply a motion transformation warping operation on a 3d image
This algorithm allows to apply a motion transformation defined by parameter
on an input image
. Available warping transformations are defined by enumerate ipsdk::math::transform::eGeometricTransform3dType.
Interpolation policy used during processing is defined by optional input parameter
(see ipsdk::imaproc::attr::eInterpolationPolicy).
On output, algorithm generates requested warped image
and optionally output mask image
. Size of output image is not ruled :
- pixels covered by transformed input image are processed using defined interpolation policy (and corresponding mask pixels are set to 1).
- pixels not covered are simply left to zero (and corresponding mask pixels are set to 0).
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 :
Example of Python code :
Example imports
import PyIPSDK
import PyIPSDK.IPSDKIPLGeometricTransform as gtrans
Code Example
inImg3d = PyIPSDK.loadTiffImageFile(inputImgPath)
transform1 = PyIPSDK.createWarpMotionTransform3d(PyIPSDK.eGeometricTransform3dType.eGT3DT_Translation,
[10, 30, -7])
outImg1 = gtrans.warp3dImg(inImg3d, transform1)
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
math::transform::Translation3d translation(10, 30, -7);
ImagePtr pOutImg1 = warp3dImg(pInImg3d, pTransform1);
ipUInt64 outputSizeX, outputSizeY, outputSizeZ;
MemoryImagePtr pOutImg2(boost::make_shared<MemoryImage>());
pOutImg2->init(*pOutGeometry2);
MemoryImagePtr pOutOptMaskImg2(boost::make_shared<MemoryImage>());
pOutOptMaskImg2->init(*pOutMaskGeometry2);