ResampleAffine3d
Resamples an image by defining an oriented bounding box and a geometric transform.
Access to parameter description
This algorithm allows the resampling of an input image onto an arbitrary image domain, and optionally apply a geometric transform on it.
The output image domain is defined by a non-axis aligned bounding box (nAABB). To represent the nAABB, we use an AABB (boundingBoxMin, boundingBoxMax) and a transformation (boundingBoxTransform).
An additional transformation can be applied to each output voxel position to produce the final resampled image. Each output voxel intensity is extracted from the input with a user-defined interpolation.
For example, this algorithm can be used:
Access to parameter description
This algorithm allows the resampling of an input image onto an arbitrary image domain, and optionally apply a geometric transform on it.
The output image domain is defined by a non-axis aligned bounding box (nAABB). To represent the nAABB, we use an AABB (boundingBoxMin, boundingBoxMax) and a transformation (boundingBoxTransform).
An additional transformation can be applied to each output voxel position to produce the final resampled image. Each output voxel intensity is extracted from the input with a user-defined interpolation.
For example, this algorithm can be used:
- To extract an arbitrary sub-volume with an arbitrary voxel size (not necessary aligned with the input) from the input image.
- To generate a new image from a model image registered on reference image using the transform given by the AffineRegistration algorithm.
Function Syntax
This function returns outputImage.
// Function prototype
std::shared_ptr< iolink::ImageView > resampleAffine3d( std::shared_ptr< iolink::ImageView > inputImage, iolink::Vector3d boundingBoxMin, iolink::Vector3d boundingBoxMax, iolink::Matrix4d boundingBoxTransform, ResampleAffine3d::SamplingMode samplingMode, iolink::Vector3u32 imageDimensions, ResampleAffine3d::InterpolationType interpolationType, double paddingValue, iolink::Matrix4d transform, std::shared_ptr< iolink::ImageView > outputImage = NULL );
Class Syntax
Parameters
Parameter Name | Description | Type | Supported Values | Default Value | |||||
---|---|---|---|---|---|---|---|---|---|
![]() |
inputImage |
The input image to resample. It can have integer or floating point data type. | Image | Grayscale | nullptr | ||||
![]() |
boundingBoxMin |
The origin of the bounding box defining the output image, in world coordinates. The resulting bounding box is an axis aligned box in the 3D space. | Vector3d | Any value | {0.f, 0.f, 0.f} | ||||
![]() |
boundingBoxMax |
The end point of the bounding box defining the output image, in world coordinates. The resulting bounding box is an axis aligned box in the 3D space. | Vector3d | Any value | {1.f, 1.f, 1.f} | ||||
![]() |
boundingBoxTransform |
The geometric transformation defining the bounding box orientation of the output image, represented by a 4x4 matrix. | Matrix4d | IDENTITY | |||||
![]() |
samplingMode |
The way to determine the resolution of the output image.
|
Enumeration | AUTOMATIC | |||||
![]() |
imageDimensions |
The size in pixels of the output image in each axis direction. If the samplingMode parameter is set to AUTOMATIC, this parameter is ignored. | Vector3u32 | != 0 | {1, 1, 1} | ||||
![]() |
interpolationType |
The method used to calculate the intensity of each pixel in the result image.
|
Enumeration | LINEAR | |||||
![]() |
paddingValue |
Specifies the output value if an output voxel position is outside the bounding box of the input image. | Float64 | Any value | 0 | ||||
![]() |
transform |
The geometric transformation applied to all output voxel positions before the interpolation, represented by a 4x4 matrix. | Matrix4d | IDENTITY | |||||
![]() |
outputImage |
The output image. Its dimensions are either defined by the imageDimensions parameter, if the samplingMode parameter is MANUAL, or automatically computed to match the user-defined bounding box with a resolution close to that of the input image. Its calibration is automatically adapted. Its type and interpretation are the same as the input image. | Image | nullptr |
Object Examples
auto foam = readVipImage( std::string( IMAGEDEVDATA_IMAGES_FOLDER ) + "foam.vip" ); ResampleAffine3d resampleAffine3dAlgo; resampleAffine3dAlgo.setInputImage( foam ); resampleAffine3dAlgo.setBoundingBoxMin( {0, 0, 0} ); resampleAffine3dAlgo.setBoundingBoxMax( {10, 10, 10} ); resampleAffine3dAlgo.setBoundingBoxTransform( iolink::Matrix4d::identity() ); resampleAffine3dAlgo.setSamplingMode( ResampleAffine3d::SamplingMode::AUTOMATIC ); resampleAffine3dAlgo.setImageDimensions( {10, 10, 10} ); resampleAffine3dAlgo.setInterpolationType( ResampleAffine3d::InterpolationType::LINEAR ); resampleAffine3dAlgo.setPaddingValue( 0 ); resampleAffine3dAlgo.setTransform( iolink::Matrix4d({1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0}) ); resampleAffine3dAlgo.execute(); std::cout << "outputImage:" << resampleAffine3dAlgo.outputImage()->toString();
Function Examples
auto foam = readVipImage( std::string( IMAGEDEVDATA_IMAGES_FOLDER ) + "foam.vip" ); auto result = resampleAffine3d( foam, {0, 0, 0}, {10, 10, 10}, iolink::Matrix4d::identity(), ResampleAffine3d::SamplingMode::AUTOMATIC, {10, 10, 10}, ResampleAffine3d::InterpolationType::LINEAR, 0, iolink::Matrix4d({1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0}) ); std::cout << "outputImage:" << result->toString();