RigidTransformResample¶
使用刚性变换对图像进行重采样
描述¶
该应用程序对输入图像执行参数转换。使用缩放因子处理缩放、平移和旋转。变换的参数以物理单位表示,因此必须特别注意像素大小(值和符号)。此外,变换是从输入空间到输出空间的表示(相反,ITK变换是从输出空间到输入空间的表示)。
参数¶
Input image -in image
Mandatory
The input image to translate.
Output image -out image [dtype]
Mandatory
The transformed output image.
变换参数¶
这组参数允许设置要应用的转换。
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 scaling - translation
translation - rotation
rotation
ID选项¶
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
翻译选项¶
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 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 fast - Bicubic interpolation
双三次插值选项¶
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)
实例¶
从命令行执行以下操作:
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.
来自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()