ImageDev

SetSliceToVolume3d

Pastes a 2D image into a plane orthogonal to an axis of a 3D volume.

Access to parameter description

The SetSliceToVolume3d algorithm pastes a plane into a 3D image.
The 2D image must have dimensions consistent with the volume dimensions and the selected axis:
$$ \begin{array}{|c||c|c|c||} \hline \textbf{Selected Axis} & \textbf{Plane} & \textbf{$gx_s$} & \textbf{$gy_s$} \\ \hline \hline \textbf{X} & YZ & gy_v & gz_v \\ \hline \textbf{Y} & XZ & gx_v & gz_v \\ \hline \textbf{Z} & XY & gx_v & gy_v \\ \hline \end{array} $$ Where $(gx_v, gy_v, gz_v)$ is the input volume size in voxels for the X, Y, and Z directions and $(gx_s, gy_s)$ is the input slice size in pixels for the X and Y directions.
An exception is thrown if the input slice dimensions are not in compliance with this rule.

See also

Function Syntax

This function returns outputImage.
// Function prototype
std::shared_ptr< iolink::ImageView > setSliceToVolume3d( std::shared_ptr< iolink::ImageView > inputDestinationImage, std::shared_ptr< iolink::ImageView > inputSourceImage, SetSliceToVolume3d::Axis axis, int32_t sliceIndex, std::shared_ptr< iolink::ImageView > outputImage = nullptr );
This function returns outputImage.
// Function prototype.
set_slice_to_volume_3d(input_destination_image: idt.ImageType,
                       input_source_image: idt.ImageType,
                       axis: SetSliceToVolume3d.Axis = SetSliceToVolume3d.Axis.Z_AXIS,
                       slice_index: int = 1,
                       output_image: idt.ImageType = None) -> idt.ImageType
This function returns outputImage.
// Function prototype.
public static IOLink.ImageView
SetSliceToVolume3d( IOLink.ImageView inputDestinationImage,
                    IOLink.ImageView inputSourceImage,
                    SetSliceToVolume3d.Axis axis = ImageDev.SetSliceToVolume3d.Axis.Z_AXIS,
                    Int32 sliceIndex = 1,
                    IOLink.ImageView outputImage = null );

Class Syntax

Parameters

Parameter Name Description Type Supported Values Default Value
input
inputDestinationImage
The input 3D image (the volume where the slice is inserted). Image Binary, Label, Grayscale or Multispectral nullptr
input
inputSourceImage
The input 2D image (the slice to insert). Image Binary, Label, Grayscale or Multispectral nullptr
input
axis
The axis orthogonal to the plane to set.
X_AXIS This mode sets the input plane orthogonal to X axis.
Y_AXIS This mode sets the input plane orthogonal to Y axis.
Z_AXIS This mode sets the input plane orthogonal to Z axis.
Enumeration Z_AXIS
input
sliceIndex
The axis index where to insert the slice. Int32 >=0 1
output
outputImage
The output image. Image nullptr
Parameter Name Description Type Supported Values Default Value
input
input_destination_image
The input 3D image (the volume where the slice is inserted). image Binary, Label, Grayscale or Multispectral None
input
input_source_image
The input 2D image (the slice to insert). image Binary, Label, Grayscale or Multispectral None
input
axis
The axis orthogonal to the plane to set.
X_AXIS This mode sets the input plane orthogonal to X axis.
Y_AXIS This mode sets the input plane orthogonal to Y axis.
Z_AXIS This mode sets the input plane orthogonal to Z axis.
enumeration Z_AXIS
input
slice_index
The axis index where to insert the slice. int32 >=0 1
output
output_image
The output image. image None
Parameter Name Description Type Supported Values Default Value
input
inputDestinationImage
The input 3D image (the volume where the slice is inserted). Image Binary, Label, Grayscale or Multispectral null
input
inputSourceImage
The input 2D image (the slice to insert). Image Binary, Label, Grayscale or Multispectral null
input
axis
The axis orthogonal to the plane to set.
X_AXIS This mode sets the input plane orthogonal to X axis.
Y_AXIS This mode sets the input plane orthogonal to Y axis.
Z_AXIS This mode sets the input plane orthogonal to Z axis.
Enumeration Z_AXIS
input
sliceIndex
The axis index where to insert the slice. Int32 >=0 1
output
outputImage
The output image. Image null

Object Examples

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

SetSliceToVolume3d setSliceToVolume3dAlgo;
setSliceToVolume3dAlgo.setInputDestinationImage( foam );
setSliceToVolume3dAlgo.setInputSourceImage( foam_2d );
setSliceToVolume3dAlgo.setAxis( SetSliceToVolume3d::Axis::Z_AXIS );
setSliceToVolume3dAlgo.setSliceIndex( 1 );
setSliceToVolume3dAlgo.execute();

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

set_slice_to_volume_3d_algo = imagedev.SetSliceToVolume3d()
set_slice_to_volume_3d_algo.input_destination_image = foam
set_slice_to_volume_3d_algo.input_source_image = foam_2d
set_slice_to_volume_3d_algo.axis = imagedev.SetSliceToVolume3d.Z_AXIS
set_slice_to_volume_3d_algo.slice_index = 1
set_slice_to_volume_3d_algo.execute()

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

SetSliceToVolume3d setSliceToVolume3dAlgo = new SetSliceToVolume3d
{
    inputDestinationImage = foam,
    inputSourceImage = foam_2d,
    axis = SetSliceToVolume3d.Axis.Z_AXIS,
    sliceIndex = 1
};
setSliceToVolume3dAlgo.Execute();

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

Function Examples

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

auto result = setSliceToVolume3d( foam, foam_2d, SetSliceToVolume3d::Axis::Z_AXIS, 1 );

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

result = imagedev.set_slice_to_volume_3d(foam, foam_2d, imagedev.SetSliceToVolume3d.Z_AXIS, 1)

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

IOLink.ImageView result = Processing.SetSliceToVolume3d( foam, foam_2d, SetSliceToVolume3d.Axis.Z_AXIS, 1 );

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