ImageDev

RotateImage3d

Applies a rotation of a given angle on a three-dimensional image.

Access to parameter description

This command is deprecated, it will be removed in ImageDev 2024.2.
You can use Rotate3d instead.

This algorithm rotates a 3D image of a user-defined angle $(\theta_x,\theta_y,\theta_z)$ in Euler angles notation.
The new coordinates $(x',y',z')$ can be expressed as a function of the old coordinates $(x,y,z)$: $$ \begin{bmatrix}x'\\y'\\z'\end{bmatrix} = R_x(\theta_x)\cdot R_y(\theta_y)\cdot R_z(\theta_z)\cdot\begin{bmatrix}x\\y\\z\end{bmatrix} $$ where: $$ R_x(\theta)=\begin{bmatrix} 1 & 0 & 0 \\ 0 & \cos\theta & -\sin\theta \\ 0 & \sin\theta & \cos\theta \end{bmatrix} $$ $$ R_y(\theta)=\begin{bmatrix} \cos\theta & 0 & \sin\theta \\ 0 & 1 & 0 \\
\sin\theta & 0 & \cos\theta \end{bmatrix} $$ $$ R_z(\theta)=\begin{bmatrix} \cos\theta & -\sin\theta & 0 \\ \sin\theta & \cos\theta & 0 \\ 0 & 0 & 1 \end{bmatrix} $$ See also

Function Syntax

This function returns outputImage.
// Function prototype
std::shared_ptr< iolink::ImageView > rotateImage3d( std::shared_ptr< iolink::ImageView > inputImage, double rotationAngleX, double rotationAngleY, double rotationAngleZ, RotateImage3d::InterpolationType interpolationType, std::shared_ptr< iolink::ImageView > outputImage = nullptr );
This function returns outputImage.
// Function prototype.
rotate_image_3d(input_image: idt.ImageType,
                rotation_angle_x: float = 90,
                rotation_angle_y: float = 0,
                rotation_angle_z: float = 0,
                interpolation_type: RotateImage3d.InterpolationType = RotateImage3d.InterpolationType.NEAREST_NEIGHBOR,
                output_image: idt.ImageType = None) -> idt.ImageType
This function returns outputImage.
// Function prototype.
public static IOLink.ImageView
RotateImage3d( IOLink.ImageView inputImage,
               double rotationAngleX = 90,
               double rotationAngleY = 0,
               double rotationAngleZ = 0,
               RotateImage3d.InterpolationType interpolationType = ImageDev.RotateImage3d.InterpolationType.NEAREST_NEIGHBOR,
               IOLink.ImageView outputImage = null );

Class Syntax

Parameters

Parameter Name Description Type Supported Values Default Value
input
inputImage
The input grayscale image. Image Binary, Label, Grayscale or Multispectral nullptr
input
rotationAngleX
The angle of rotation in degrees for the OX axis. Float64 Any value 90
input
rotationAngleY
The angle of rotation in degrees for the OY axis. Float64 Any value 0
input
rotationAngleZ
The angle of rotation in degrees for the OZ axis. Float64 Any value 0
input
interpolationType
The interpolation mode. Method used to calculate the intensity of each pixel in the result image.
NEAREST_NEIGHBOR Assign the gray level of the nearest pixel.
LINEAR Assign the bilinear interpolation from the four nearest pixels.
Enumeration NEAREST_NEIGHBOR
output
outputImage
The output image. Its dimensions and type are forced to the same values as the input. Image nullptr
Parameter Name Description Type Supported Values Default Value
input
input_image
The input grayscale image. image Binary, Label, Grayscale or Multispectral None
input
rotation_angle_x
The angle of rotation in degrees for the OX axis. float64 Any value 90
input
rotation_angle_y
The angle of rotation in degrees for the OY axis. float64 Any value 0
input
rotation_angle_z
The angle of rotation in degrees for the OZ axis. float64 Any value 0
input
interpolation_type
The interpolation mode. Method used to calculate the intensity of each pixel in the result image.
NEAREST_NEIGHBOR Assign the gray level of the nearest pixel.
LINEAR Assign the bilinear interpolation from the four nearest pixels.
enumeration NEAREST_NEIGHBOR
output
output_image
The output image. Its dimensions and type are forced to the same values as the input. image None
Parameter Name Description Type Supported Values Default Value
input
inputImage
The input grayscale image. Image Binary, Label, Grayscale or Multispectral null
input
rotationAngleX
The angle of rotation in degrees for the OX axis. Float64 Any value 90
input
rotationAngleY
The angle of rotation in degrees for the OY axis. Float64 Any value 0
input
rotationAngleZ
The angle of rotation in degrees for the OZ axis. Float64 Any value 0
input
interpolationType
The interpolation mode. Method used to calculate the intensity of each pixel in the result image.
NEAREST_NEIGHBOR Assign the gray level of the nearest pixel.
LINEAR Assign the bilinear interpolation from the four nearest pixels.
Enumeration NEAREST_NEIGHBOR
output
outputImage
The output image. Its dimensions and type are forced to the same values as the input. Image null

Object Examples

auto foam = readVipImage( std::string( IMAGEDEVDATA_IMAGES_FOLDER ) + "foam.vip" );

RotateImage3d rotateImage3dAlgo;
rotateImage3dAlgo.setInputImage( foam );
rotateImage3dAlgo.setRotationAngleX( 90.0 );
rotateImage3dAlgo.setRotationAngleY( 0.0 );
rotateImage3dAlgo.setRotationAngleZ( 0.0 );
rotateImage3dAlgo.setInterpolationType( RotateImage3d::InterpolationType::NEAREST_NEIGHBOR );
rotateImage3dAlgo.execute();

std::cout << "outputImage:" << rotateImage3dAlgo.outputImage()->toString();
foam = imagedev.read_vip_image(imagedev_data.get_image_path("foam.vip"))

rotate_image_3d_algo = imagedev.RotateImage3d()
rotate_image_3d_algo.input_image = foam
rotate_image_3d_algo.rotation_angle_x = 90.0
rotate_image_3d_algo.rotation_angle_y = 0.0
rotate_image_3d_algo.rotation_angle_z = 0.0
rotate_image_3d_algo.interpolation_type = imagedev.RotateImage3d.NEAREST_NEIGHBOR
rotate_image_3d_algo.execute()

print("output_image:", str(rotate_image_3d_algo.output_image))
ImageView foam = Data.ReadVipImage( @"Data/images/foam.vip" );

RotateImage3d rotateImage3dAlgo = new RotateImage3d
{
    inputImage = foam,
    rotationAngleX = 90.0,
    rotationAngleY = 0.0,
    rotationAngleZ = 0.0,
    interpolationType = RotateImage3d.InterpolationType.NEAREST_NEIGHBOR
};
rotateImage3dAlgo.Execute();

Console.WriteLine( "outputImage:" + rotateImage3dAlgo.outputImage.ToString() );

Function Examples

auto foam = readVipImage( std::string( IMAGEDEVDATA_IMAGES_FOLDER ) + "foam.vip" );

auto result = rotateImage3d( foam, 90.0, 0.0, 0.0, RotateImage3d::InterpolationType::NEAREST_NEIGHBOR );

std::cout << "outputImage:" << result->toString();
foam = imagedev.read_vip_image(imagedev_data.get_image_path("foam.vip"))

result = imagedev.rotate_image_3d(foam, 90.0, 0.0, 0.0, imagedev.RotateImage3d.NEAREST_NEIGHBOR)

print("output_image:", str(result))
ImageView foam = Data.ReadVipImage( @"Data/images/foam.vip" );

IOLink.ImageView result = Processing.RotateImage3d( foam, 90.0, 0.0, 0.0, RotateImage3d.InterpolationType.NEAREST_NEIGHBOR );

Console.WriteLine( "outputImage:" + result.ToString() );