VisionX V4 | V3RBODY | VisionX V4 |
v3rbody − Three-dimensional Rigid-Body Transformation |
v3rbody [-H] [if=<inputfile>] [of=<outputfile>] [t=<value>] [r=<value>] [p=<value>] [-deg] [-2d] [ptf=<value>] [-t] [ipf=<value>] [opf=<value>] [-bbx] [-nn] [-v] [-vls] [-m] [b=] [-f] |
v3rbody performs a three-dimensional rigid-body transformation on a 3D image (byte, short, or float format). There are nine paremeters for the transformation: translation (tx,ty,tz), rotation (rx,ry,rz), and the point of rotation (px,py,pz). The program has three ways of obtaining these parameters: |
1) Command-line: |
Using the t=, r=, and p= command-line parameters. The -deg option can also be used to specify the rotation in degrees. The -2d option to input 2D rigid-body parameters. The -f option enables frame i/o and should be used for files with large size. |
2) Control-Points VX File: |
The control-points file is a VisionX file with a list of length-6 VX_V3D elements. Each VX_V3D element (x,y,z,x’,y’,z’) refers to a control point (x,y,z) and its desired new position (x’,y’,z’). The program uses Least-Squares Adjustment, an iterative algorithm, to determine the best-fit rigid-body parameters for the transformation between the points (x,y,z) and the points (x’,y’,z’). The -t option can be used to calculate only the translation parameters by finding the average movement of all the control points. The parameters obtained using this file overrides the command-line parameters, t=, r=, and p=. |
3) Parameter Text File: |
This option allows a sequence of rigid-body transformations to be applied to the input image. A Parameter text file contains the parameters for a sequence of rigid-body transformations. Each line of the file contains a set of rigid-body parameters, <tx,ty,tz,rx,ry,rz,px,py,pz>. The transformation specified by options 1) or 2) are appended to the end of the list, and the parameters for the overall transformation are calculated. The rotation paremeters in the text file are in radians only. Using this option has the advantage that the interpolation uses the original image rather than any intermediate interpolated images, thus avoiding distortions caused by interpolating an interpolated image |
By default, the warped image has the same bounding box as the input image. Using the -bbx option will force the program to calculate a tight bounding box around the warped image such that the entire input image is mapped into the warped image. The program calculates the warped image by using backwards mapping. For each voxel in the warped image, a reverse rigid-body transformation is applied to find the point in the input image where the warped image voxel was mapped from. Finally, the value at this point is found by using trilinear interpolation (default) or nearest neighbor interpolation (-nn option). Pixels that cannot be interpolated are set to the background value (default=0). The -m option outputs the coordinates of the pixel mapping from the output image to the input image. In this case the output is a 3-channel float image where the backwards-mapped (X,Y,Z) coordinates are stored separately in each channel. The output parameter file (opf) is a text file that contains a list of the parameters of the rigid-body transformations that were applied to the image. It has the same format as the input parameter file. The ipf and opf files can be the same; in this case the opf file is appended with the new rigid-body parameters. |
Given the 9 parameters, the transformation is defined as: |
1) |
rotation (rx,ry,rz) about the point (px,py,pz), where the rotation order is z,y,x |
||
2) |
translation by (tx,ty,tz) |
We can do multiple-pass registration by using the ipf and opf files to apply sequences of rigid-body transformations to an image. For example, a 2-pass registration of im1.vx to im2.vx: |
1) |
find control points from im1 and im2; store in im1_im2.pts |
||
2) |
first pass transformation: rbody3d if=im1.vx of=im1.rb1 ptf=im1_im2.pts opf=regparam -bbx |
||
3) |
find control points from im1.rb1 and im2.vx; store in im1_im2.pts2 |
||
4) |
second pass transformation (append the new parameters to the old): rbody3d if=im1.vx of=im1.rb2 ptf=im1_im2.pts2 ipf=regparam opf=regparam -bbx |
The image im1.rb2 is the two-pass registered image and the regparam file contains the two rigid-body transformations used. |
if= |
3D image input -- byte, short, or float |
||
of= |
the warped image (same pixel type and bounding box as the input image), or a pixel map(3-channel float image w/ bounding box of input image) |
||
t= |
tx[,ty[,tz]]: translation parameters |
||
r= |
rx[,ry[,rz]]: rotation parameters in radians |
||
p= |
px[,py[,pz]]: the point of rotation (default = origin) |
||
-deg |
rotation is specified in degrees rather than radians |
||
-2d |
the t,r,p parameters are for a two-dimensional rigid-body transformation: t=tx[,ty]; r=rot; p=px[,py] |
||
-f |
Frame I/O: Process one frame at a time. Use for files with large size. (default: File I/O) |
||
ptf= |
Control Points File: Calculate the rigid-body parameters using control points. Overrides any parameters specified in t, r, or p. |
||
-t |
Using the ptf file, calculate only translation parameters. |
||
ipf= |
Input Param Text File: Apply these rigid-body parameters followed by the command-line parameters by concatenating them into a single transformation. |
||
opf= |
Output Param Text File: List of the rigid-body parameters that were applied to the image. Same format as the ipf file. |
||
-bbx |
Calculate a new tight bounding box for the warped image. |
||
-nn |
use nearest neighbor interpolation (default= trilinear interpolation) |
||
-v |
verbose option |
||
-lsv |
least-squares verbose option -- show iterations when calculating the parameters from the control points. |
||
-m |
output a pixel map: 3-channel 3D float image |
||
b= |
background value (default=0) |
* |
Can only handle byte, float, or short images |
||
* |
Least-Squares adjustment requires a minimum of 2 feature points. |
||
* |
If there are control points moving in conflicting directions for a rigid-body transformation, the algorithm may not converge. The algorithm stops after 200 iterations or the parameters do not change by more than 0.000001. |
-- |
-- |
A. B. Chan, Summer 2001 |