Resamples along z-axis a 3d image with unregularly spaced z-plans.
This algorithm allows to resample along z-axis a 3d image with unregularly spaced z-plans, so that the resulting 3d image z-plans are regularly spaced.
The parameters of this algorithm are:
: integral value, strictly positive, specifying the size of the resulting image along its z-axis. This parameter is used only if the geometry of the output image is initialized by the algorithm, not by the user,
s: collection of numerical values, strictly positive, specifying the distance between consecutive z-slices of the input image. The size of this collection must equal to the size of the input 3d image along z-axis, minus one,
: enumerate permitting to specify the interpolation method used to resample the image. The following interpolation methods are available:
- eInterpolationPolicy::eIP_NearestNeighbour: the voxel value of the output image at position (xOut, yOut, zOut) equals to the value of the voxel nearest to the associated position in the input image along the z-axis. This is the certainly one of the fastest methods, but it generates a coarse image, with aliasing,
- eInterpolationPolicy::eIP_Linear: for each voxel of the output image, voxel value is computed by doing a linear interpolation on the 2 nearest neighbours along the z-axis. It gives satisfying results, and it is a good compromise between speed and quality,
- eInterpolationPolicy::eIP_Cubic: for each voxel of the output image, voxel value is computed by doing a cubic interpolation on the 4 nearest neighbours along the z-axis. This method is slower than the linear interpolation, but it usually gives better results, generating sharper edges than linear interpolation.
If the user allocates the output image, this last one must satisfy the following criterions:
- its sizes along x-axis and y-axis must equal to the sizes of the input image along x-axis and y-axis,
- its temporal size must equal to the temporal size of the input image,
- the number of its color channel must equal to the number of color channels of the input image.
Example of Python code :
Example imports
import PyIPSDK
import PyIPSDK.IPSDKIPLGeometricTransform as gtrans
Code Example
inputImgPath = os.path.join(utImagesPath, "heterogeneousSubSample.tif")
inImg = PyIPSDK.loadTiffImageFile(inputImgPath)
zSteps = PyIPSDK.createZSteps([ 1.1, 0.1, 0.1, 0.7, 1.3, 1.2, 0.5, 0.8, 0.7, 0.7, 0.6, 0.7, 1.4 ])
outImg = gtrans.resampleCustomZStack3dImg(inImg, zSteps, 100, PyIPSDK.eInterpolationPolicy.eIP_Cubic)
Example of C++ code :
Example informations
Header file
#include <IPSDKIPL/IPSDKIPLGeometricTransform/Processor/ResampleCustomZStack3dImg/ResampleCustomZStack3dImg.h>
Code Example
boost::shared_ptr<attr::ZSteps> pZSteps = attr::ZSteps::createNode();
pZSteps->push_back<attr::ZSteps::StepsColl>(0.990f);
pZSteps->push_back<attr::ZSteps::StepsColl>(1.015f);
pZSteps->push_back<attr::ZSteps::StepsColl>(0.988f);
pZSteps->push_back<attr::ZSteps::StepsColl>(0.994f);
pZSteps->push_back<attr::ZSteps::StepsColl>(1.007f);
pZSteps->push_back<attr::ZSteps::StepsColl>(0.995f);
pZSteps->push_back<attr::ZSteps::StepsColl>(0.997f);
pZSteps->push_back<attr::ZSteps::StepsColl>(0.996f);
pZSteps->push_back<attr::ZSteps::StepsColl>(1.007f);
pZSteps->push_back<attr::ZSteps::StepsColl>(1.003f);
pZSteps->push_back<attr::ZSteps::StepsColl>(0.998f);
pZSteps->push_back<attr::ZSteps::StepsColl>(0.994f);
pZSteps->push_back<attr::ZSteps::StepsColl>(0.999f);