DIPlib Documentation - ©1995-2017 Quantitative Imaging Group, Delft University of Technology.

Rotation3d

Interpolation function

SYNOPSIS

#include "dip_interpolation.h"

dip_Error dip_Rotation3d ( in, out, alpha, beta, gamma, method, bgval )

DATA TYPES

binary, integer, float

FUNCTION

This function rotates an 3-D image in via the three Euler angles alpha, beta, gamma to out using nine skews. The first rotation is about alpha around the initial 3-axis. The second about beta around the intermediate 2-axis and the last about gamma around the final 3-axis. The function implements the rotation in the mathmetical sense, but note the Y-axis is positive downwards! The rotation is over the centre of the image.

ARGUMENTS

Data typeNameDescription
dip_ImageinInput image
dip_ImageoutOutput image
dip_floatalpha (radians)Euler angle
dip_floatbeta (radians)Euler angle
dip_floatgamma (radians)Euler angle
dipf_InterpolationmethodInterpolation method
dip_BackgroundValuebgvalBackground value

The dipf_Interpolation enumaration consists of the following constants:

NameDescription
DIP_INTERPOLATION_DEFAULTDefault method, usually equivalent to DIP_INTERPOLATION_BSPLINE
DIP_INTERPOLATION_BSPLINEB-Spline interpolation
DIP_INTERPOLATION_FOURTH_ORDER_CUBICForth order cubic interpolation
DIP_INTERPOLATION_THIRD_ORDER_CUBICThird order cubic interpolation
DIP_INTERPOLATION_LINEARLinear interpolation
DIP_INTERPOLATION_ZERO_ORDER_HOLDZero order hold interpolation
DIP_INTERPOLATION_NEAREST_NEIGHBOURNearest neighbour interpolation
DIP_INTERPOLATION_LANCZOS_2Lanczos interpolation with a=2
DIP_INTERPOLATION_LANCZOS_3Lanczos interpolation with a=3
DIP_INTERPOLATION_LANCZOS_4Lanczos interpolation with a=4
DIP_INTERPOLATION_LANCZOS_6Lanczos interpolation with a=6
DIP_INTERPOLATION_LANCZOS_8Lanczos interpolation with a=8

All interpolation is performed separably. B-spline interpolation uses all samples on the image line. Cubic interpolation uses a cubic spline kernel (piecewise cubic polynomial), covering 4 (third order) or 6 (fourth order) input samples. Lanczos interpolation uses a sinc function windowed by a wider sinc function, using 2a input samples. Zero order hold and nearest neighbour are the same method, but for the function Resampling, zero order hold results in a shift of half a pixel (i.e. the nearest value "to the left" is always used).

The dip_BackgroundValue enumaration consists of the following flags:

NameDescription
DIP_BGV_DEFAULTDefault: fill with zeros
DIP_BGV_ZEROFill with zeros
DIP_BGV_MAX_VALUEFill with maximum value for data type
DIP_BGV_MIN_VALUEFill with minimum value for data type

KNOWN BUGS

This function is only implemented for 3D images, for rotating 2D images see Rotation.

SEE ALSO

Skewing, Rotation, Rotation3d_Axis