Shearing3d
Applies a three-dimensional shear transformation along a user-defined direction.
Access to parameter description
This algorithm applies a shear transformation which can be seen as the translation of axis-aligned slices along a user-defined direction. It shears the input volume using 2 axes. The first axis (slice axis) is the axis of influence; it, together with the shear angle, determines the shift value. The second axis (shift axis) defines the direction along which the slices are translated.
For instance, if the shift axis is z and the slice axis is y, then the transformation only affects the z-coordinate of an input point, resulting in the newly transformed coordinate z'. $$ z' = z + \tan(\alpha) y $$ Using the matrix notation, the transformation $T(X)$ of a point $X \in R^3$ is given by: $$ T(X) = SX $$ $S$ is a $3 \times 3$ matrix where all diagonal elements are equal to 1, and all non-diagonal elements are equal to 0 except the one at position $(i, j)$, which takes the value $\tan(\alpha)$. Here, $i$ represents the index of the shift axis, $j$ represents the index of the slice axis (0 for x, 1 for y, 2 for z), and $\alpha$ represents the shearing angle.
If the slice axis is y (i=1), and the shift axis z (j=2), then $$ S = \begin{bmatrix} 1 & 0 & 0 \\ 0 & 1 & 0 \\ 0 & \tan(\alpha) & 1 \\ \end{bmatrix} $$
Figure 1. : (left) the original image; (right) shearing with y as the shift axis, z as the slice
axis (xy slices are shifted), angle is 38°
See also
Access to parameter description
This algorithm applies a shear transformation which can be seen as the translation of axis-aligned slices along a user-defined direction. It shears the input volume using 2 axes. The first axis (slice axis) is the axis of influence; it, together with the shear angle, determines the shift value. The second axis (shift axis) defines the direction along which the slices are translated.
For instance, if the shift axis is z and the slice axis is y, then the transformation only affects the z-coordinate of an input point, resulting in the newly transformed coordinate z'. $$ z' = z + \tan(\alpha) y $$ Using the matrix notation, the transformation $T(X)$ of a point $X \in R^3$ is given by: $$ T(X) = SX $$ $S$ is a $3 \times 3$ matrix where all diagonal elements are equal to 1, and all non-diagonal elements are equal to 0 except the one at position $(i, j)$, which takes the value $\tan(\alpha)$. Here, $i$ represents the index of the shift axis, $j$ represents the index of the slice axis (0 for x, 1 for y, 2 for z), and $\alpha$ represents the shearing angle.
If the slice axis is y (i=1), and the shift axis z (j=2), then $$ S = \begin{bmatrix} 1 & 0 & 0 \\ 0 & 1 & 0 \\ 0 & \tan(\alpha) & 1 \\ \end{bmatrix} $$
![]() |
![]() |
See also
Function Syntax
This function returns outputImage.
// Function prototype
std::shared_ptr< iolink::ImageView > shearing3d( std::shared_ptr< iolink::ImageView > inputImage, Shearing3d::Axis sliceAxis, Shearing3d::Axis shiftAxis, double angle, double sliceAxisOrigin, Shearing3d::OutputSpacingMode outputSpacingMode, const iolink::Vector3d& outputSpacing, double paddingValue, std::shared_ptr< iolink::ImageView > outputImage = nullptr );
This function returns outputImage.
// Function prototype. shearing_3d(input_image: idt.ImageType, slice_axis: Shearing3d.Axis = Shearing3d.Axis.Y_AXIS, shift_axis: Shearing3d.Axis = Shearing3d.Axis.Z_AXIS, angle: float = 38, slice_axis_origin: float = 0, output_spacing_mode: Shearing3d.OutputSpacingMode = Shearing3d.OutputSpacingMode.SAME_AS_INPUT, output_spacing: Union[Iterable[int], Iterable[float]] = [1, 1, 1], padding_value: float = 0, output_image: idt.ImageType = None) -> idt.ImageType
This function returns outputImage.
// Function prototype. public static IOLink.ImageView Shearing3d( IOLink.ImageView inputImage, Shearing3d.Axis sliceAxis = ImageDev.Shearing3d.Axis.Y_AXIS, Shearing3d.Axis shiftAxis = ImageDev.Shearing3d.Axis.Z_AXIS, double angle = 38, double sliceAxisOrigin = 0, Shearing3d.OutputSpacingMode outputSpacingMode = ImageDev.Shearing3d.OutputSpacingMode.SAME_AS_INPUT, double[] outputSpacing = null, double paddingValue = 0, IOLink.ImageView outputImage = null );
Class Syntax
Parameters
Parameter Name | Description | Type | Supported Values | Default Value | |||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() |
inputImage |
The input image. | Image | Binary, Label, Grayscale or Multispectral | nullptr | ||||||
![]() |
sliceAxis |
The axis orthogonal to the slices that are shifted. If the z-axis is selected as the slice axis, the xy slices are shifted along the x or y direction.
|
Enumeration | Y_AXIS | |||||||
![]() |
shiftAxis |
The direction toward which the slices are shifted. If the z-axis is selected as the slice axis and the y-axis as the shift axis, the xy-slices are shifted along the y direction.
|
Enumeration | Z_AXIS | |||||||
![]() |
sliceAxisOrigin |
The slice index along the slice axis which defines the origin of the transformation, that is the plane that is not shifted by the shearing transform. | Float64 | Any value | 0 | ||||||
![]() |
angle |
The shear angle. It represents the angle in degrees between the initial slice axis and the shifted axis. | Float64 | [-90, 90] | 38 | ||||||
![]() |
outputSpacingMode |
This parameter defines how to calculate the voxel size of the output volume.
|
Enumeration | SAME_AS_INPUT | |||||||
![]() |
outputSpacing |
The voxel size of the output volume along the x, y, and z axes, expressed in the same unit as the input image. It is used only when the outputSpacingMode parameter is set to OTHER. In this case, these values must be chosen carefully, ensuring consistency with those of the input volume and the unit used. A value that is too large may generate an output volume that is empty or consists of few voxels, while a value that is too small may lead to memory overflow. This parameter is not used when the spacing mode is set to SAME_AS_INPUT | Vector3d | >0 | {1.f, 1.f, 1.f} | ||||||
![]() |
paddingValue |
The background value for output voxels which are outside the input image domain. | Float64 | Any value | 0 | ||||||
![]() |
outputImage |
The output image. Its type is forced to the same values as the input. The slice and shift axes have dimensions greater than the input image and the third axes has identical dimensions. | Image | nullptr |
Parameter Name | Description | Type | Supported Values | Default Value | |||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() |
input_image |
The input image. | image | Binary, Label, Grayscale or Multispectral | None | ||||||
![]() |
slice_axis |
The axis orthogonal to the slices that are shifted. If the z-axis is selected as the slice axis, the xy slices are shifted along the x or y direction.
|
enumeration | Y_AXIS | |||||||
![]() |
shift_axis |
The direction toward which the slices are shifted. If the z-axis is selected as the slice axis and the y-axis as the shift axis, the xy-slices are shifted along the y direction.
|
enumeration | Z_AXIS | |||||||
![]() |
slice_axis_origin |
The slice index along the slice axis which defines the origin of the transformation, that is the plane that is not shifted by the shearing transform. | float64 | Any value | 0 | ||||||
![]() |
angle |
The shear angle. It represents the angle in degrees between the initial slice axis and the shifted axis. | float64 | [-90, 90] | 38 | ||||||
![]() |
output_spacing_mode |
This parameter defines how to calculate the voxel size of the output volume.
|
enumeration | SAME_AS_INPUT | |||||||
![]() |
output_spacing |
The voxel size of the output volume along the x, y, and z axes, expressed in the same unit as the input image. It is used only when the outputSpacingMode parameter is set to OTHER. In this case, these values must be chosen carefully, ensuring consistency with those of the input volume and the unit used. A value that is too large may generate an output volume that is empty or consists of few voxels, while a value that is too small may lead to memory overflow. This parameter is not used when the spacing mode is set to SAME_AS_INPUT | vector3d | >0 | [1, 1, 1] | ||||||
![]() |
padding_value |
The background value for output voxels which are outside the input image domain. | float64 | Any value | 0 | ||||||
![]() |
output_image |
The output image. Its type is forced to the same values as the input. The slice and shift axes have dimensions greater than the input image and the third axes has identical dimensions. | image | None |
Parameter Name | Description | Type | Supported Values | Default Value | |||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() |
inputImage |
The input image. | Image | Binary, Label, Grayscale or Multispectral | null | ||||||
![]() |
sliceAxis |
The axis orthogonal to the slices that are shifted. If the z-axis is selected as the slice axis, the xy slices are shifted along the x or y direction.
|
Enumeration | Y_AXIS | |||||||
![]() |
shiftAxis |
The direction toward which the slices are shifted. If the z-axis is selected as the slice axis and the y-axis as the shift axis, the xy-slices are shifted along the y direction.
|
Enumeration | Z_AXIS | |||||||
![]() |
sliceAxisOrigin |
The slice index along the slice axis which defines the origin of the transformation, that is the plane that is not shifted by the shearing transform. | Float64 | Any value | 0 | ||||||
![]() |
angle |
The shear angle. It represents the angle in degrees between the initial slice axis and the shifted axis. | Float64 | [-90, 90] | 38 | ||||||
![]() |
outputSpacingMode |
This parameter defines how to calculate the voxel size of the output volume.
|
Enumeration | SAME_AS_INPUT | |||||||
![]() |
outputSpacing |
The voxel size of the output volume along the x, y, and z axes, expressed in the same unit as the input image. It is used only when the outputSpacingMode parameter is set to OTHER. In this case, these values must be chosen carefully, ensuring consistency with those of the input volume and the unit used. A value that is too large may generate an output volume that is empty or consists of few voxels, while a value that is too small may lead to memory overflow. This parameter is not used when the spacing mode is set to SAME_AS_INPUT | Vector3d | >0 | {1f, 1f, 1f} | ||||||
![]() |
paddingValue |
The background value for output voxels which are outside the input image domain. | Float64 | Any value | 0 | ||||||
![]() |
outputImage |
The output image. Its type is forced to the same values as the input. The slice and shift axes have dimensions greater than the input image and the third axes has identical dimensions. | Image | null |
Object Examples
auto polystyrene = ioformat::readImage( std::string( IMAGEDEVDATA_IMAGES_FOLDER ) + "polystyrene.tif" ); Shearing3d shearing3dAlgo; shearing3dAlgo.setInputImage( polystyrene ); shearing3dAlgo.setSliceAxis( Shearing3d::Axis::Y_AXIS ); shearing3dAlgo.setShiftAxis( Shearing3d::Axis::Z_AXIS ); shearing3dAlgo.setAngle( 38.0 ); shearing3dAlgo.setSliceAxisOrigin( 0.0 ); shearing3dAlgo.setOutputSpacingMode( Shearing3d::OutputSpacingMode::SAME_AS_INPUT ); shearing3dAlgo.setOutputSpacing( {1.0, 1.0, 1.0} ); shearing3dAlgo.setPaddingValue( 0.0 ); shearing3dAlgo.execute(); std::cout << "outputImage:" << shearing3dAlgo.outputImage()->toString();
polystyrene = ioformat.read_image(imagedev_data.get_image_path("polystyrene.tif")) shearing_3d_algo = imagedev.Shearing3d() shearing_3d_algo.input_image = polystyrene shearing_3d_algo.slice_axis = imagedev.Shearing3d.Y_AXIS shearing_3d_algo.shift_axis = imagedev.Shearing3d.Z_AXIS shearing_3d_algo.angle = 38.0 shearing_3d_algo.slice_axis_origin = 0.0 shearing_3d_algo.output_spacing_mode = imagedev.Shearing3d.SAME_AS_INPUT shearing_3d_algo.output_spacing = [1.0, 1.0, 1.0] shearing_3d_algo.padding_value = 0.0 shearing_3d_algo.execute() print("output_image:", str(shearing_3d_algo.output_image))
ImageView polystyrene = ViewIO.ReadImage( @"Data/images/polystyrene.tif" ); Shearing3d shearing3dAlgo = new Shearing3d { inputImage = polystyrene, sliceAxis = Shearing3d.Axis.Y_AXIS, shiftAxis = Shearing3d.Axis.Z_AXIS, angle = 38.0, sliceAxisOrigin = 0.0, outputSpacingMode = Shearing3d.OutputSpacingMode.SAME_AS_INPUT, outputSpacing = new double[]{1.0, 1.0, 1.0}, paddingValue = 0.0 }; shearing3dAlgo.Execute(); Console.WriteLine( "outputImage:" + shearing3dAlgo.outputImage.ToString() );
Function Examples
auto polystyrene = ioformat::readImage( std::string( IMAGEDEVDATA_IMAGES_FOLDER ) + "polystyrene.tif" ); auto result = shearing3d( polystyrene, Shearing3d::Axis::Y_AXIS, Shearing3d::Axis::Z_AXIS, 38.0, 0.0, Shearing3d::OutputSpacingMode::SAME_AS_INPUT, {1.0, 1.0, 1.0}, 0.0 ); std::cout << "outputImage:" << result->toString();
polystyrene = ioformat.read_image(imagedev_data.get_image_path("polystyrene.tif")) result = imagedev.shearing_3d(polystyrene, imagedev.Shearing3d.Y_AXIS, imagedev.Shearing3d.Z_AXIS, 38.0, 0.0, imagedev.Shearing3d.SAME_AS_INPUT, [1.0, 1.0, 1.0], 0.0) print("output_image:", str(result))
ImageView polystyrene = ViewIO.ReadImage( @"Data/images/polystyrene.tif" ); IOLink.ImageView result = Processing.Shearing3d( polystyrene, Shearing3d.Axis.Y_AXIS, Shearing3d.Axis.Z_AXIS, 38.0, 0.0, Shearing3d.OutputSpacingMode.SAME_AS_INPUT, new double[]{1.0, 1.0, 1.0}, 0.0 ); Console.WriteLine( "outputImage:" + result.ToString() );
© 2025 Thermo Fisher Scientific Inc. All rights reserved.