RigidTransformResample¶
Resample an image with a rigid transform
Description¶
This application performs a parametric transform on the input image. Scaling, translation and rotation with scaling factor are handled. Parameters of the transform is expressed in physical units, thus particular attention must be paid on pixel size (value, and sign). Moreover transform is expressed from input space to output space (on the contrary ITK Transforms are expressed form output space to input space).
Parameters¶
Input image -in image
Mandatory
The input image to translate.
Output image -out image [dtype]
Mandatory
The transformed output image.
Transform parameters¶
This group of parameters allows setting the transformation to apply.
Type of transformation -transform.type [id|translation|rotation]
Default value: id
Type of transformation. Available transformations are spatial scaling, translation and rotation with scaling factor
id
Spatial scalingtranslation
translationrotation
rotation
id options¶
X scaling -transform.type.id.scalex float
Default value: 1
Scaling factor between the output X spacing and the input X spacing
Y scaling -transform.type.id.scaley float
Default value: 1
Scaling factor between the output Y spacing and the input Y spacing
translation options¶
The X translation (in physical units) -transform.type.translation.tx float
Default value: 0
The translation value along X axis (in physical units).
The Y translation (in physical units) -transform.type.translation.ty float
Default value: 0
The translation value along Y axis (in physical units)
X scaling -transform.type.translation.scalex float
Default value: 1
Scaling factor between the output X spacing and the input X spacing
Y scaling -transform.type.translation.scaley float
Default value: 1
Scaling factor between the output Y spacing and the input Y spacing
rotation options¶
Rotation angle -transform.type.rotation.angle float
Default value: 0
The rotation angle in degree (values between -180 and 180)
X scaling -transform.type.rotation.scalex float
Default value: 1
Scale factor between the X spacing of the rotated output image and the X spacing of the unrotated image
Y scaling -transform.type.rotation.scaley float
Default value: 1
Scale factor between the Y spacing of the rotated output image and the Y spacing of the unrotated image
Interpolation -interpolator [nn|linear|bco]
Default value: bco
This group of parameters allows one to define how the input image will be interpolated during resampling.
Nearest Neighbor interpolation
Nearest neighbor interpolation leads to poor image quality, but it is very fast.Linear interpolation
Linear interpolation leads to average image quality but is quite fastBicubic interpolation
Bicubic interpolation options¶
Radius for bicubic interpolation -interpolator.bco.radius int
Default value: 2
This parameter allows controlling the size of the bicubic interpolation filter. If the target pixel size is higher than the input pixel size, increasing this parameter will reduce aliasing artifacts.
Available RAM (MB) -ram int
Default value: 256
This allows setting the maximum amount of RAM available for processing. As the writing task is time consuming, it is better to write large pieces of data, which can be achieved by increasing this parameter (pay attention to your system capabilities)
Examples¶
From the command-line:
otbcli_RigidTransformResample -in qb_toulouse_sub.tif -out rigitTransformImage.tif -transform.type rotation -transform.type.rotation.angle 20 -transform.type.rotation.scalex 2. -transform.type.rotation.scaley 2.
From Python:
import otbApplication
app = otbApplication.Registry.CreateApplication("RigidTransformResample")
app.SetParameterString("in", "qb_toulouse_sub.tif")
app.SetParameterString("out", "rigitTransformImage.tif")
app.SetParameterString("transform.type","rotation")
app.SetParameterFloat("transform.type.rotation.angle", 20)
app.SetParameterFloat("transform.type.rotation.scalex", 2.)
app.SetParameterFloat("transform.type.rotation.scaley", 2.)
app.ExecuteAndWriteOutput()