ImageDev

GetSliceFromVolume3d

Extracts a slice orthogonal to an axis of a 3D volume.

Access to parameter description

The GetSliceFromVolume3d algorithm extracts a slice from a plane of a 3D image. This plane can be orthogonal to the X, Y, or Z axis.
The 2D image is created with dimensions deduced from 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 output slice size in pixels for the X and Y directions.

See also

Function Syntax

This function returns outputImage.
// Function prototype
std::shared_ptr< iolink::ImageView > getSliceFromVolume3d( std::shared_ptr< iolink::ImageView > inputImage, GetSliceFromVolume3d::Axis axis, int32_t sliceIndex, std::shared_ptr< iolink::ImageView > outputImage = NULL );
This function returns outputImage.
// Function prototype.
get_slice_from_volume_3d( input_image,
                          axis = GetSliceFromVolume3d.Axis.Z_AXIS,
                          slice_index = 1,
                          output_image = None )
This function returns outputImage.
// Function prototype.
public static IOLink.ImageView
GetSliceFromVolume3d( IOLink.ImageView inputImage,
                      GetSliceFromVolume3d.Axis axis = ImageDev.GetSliceFromVolume3d.Axis.Z_AXIS,
                      Int32 sliceIndex = 1,
                      IOLink.ImageView outputImage = null );

Class Syntax

Parameters

Parameter Name Description Type Supported Values Default Value
input
inputImage
The input 3D image (the volume from which the slice is extracted). Image Binary, Label, Grayscale or Multispectral nullptr
input
axis
The axis orthogonal to the plane to extract.
X_AXIS This mode extracts a plane orthogonal to X axis.
Y_AXIS This mode extracts a plane orthogonal to Y axis.
Z_AXIS This mode extracts a plane orthogonal to Z axis.
Enumeration Z_AXIS
input
sliceIndex
The axis index of the plane to extract. Int32 >=0 1
output
outputImage
The output 2D image (the extracted slice). Image nullptr
Parameter Name Description Type Supported Values Default Value
input
input_image
The input 3D image (the volume from which the slice is extracted). image Binary, Label, Grayscale or Multispectral None
input
axis
The axis orthogonal to the plane to extract.
X_AXIS This mode extracts a plane orthogonal to X axis.
Y_AXIS This mode extracts a plane orthogonal to Y axis.
Z_AXIS This mode extracts a plane orthogonal to Z axis.
enumeration Z_AXIS
input
slice_index
The axis index of the plane to extract. int32 >=0 1
output
output_image
The output 2D image (the extracted slice). image None
Parameter Name Description Type Supported Values Default Value
input
inputImage
The input 3D image (the volume from which the slice is extracted). Image Binary, Label, Grayscale or Multispectral null
input
axis
The axis orthogonal to the plane to extract.
X_AXIS This mode extracts a plane orthogonal to X axis.
Y_AXIS This mode extracts a plane orthogonal to Y axis.
Z_AXIS This mode extracts a plane orthogonal to Z axis.
Enumeration Z_AXIS
input
sliceIndex
The axis index of the plane to extract. Int32 >=0 1
output
outputImage
The output 2D image (the extracted slice). Image null

Object Examples

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

GetSliceFromVolume3d getSliceFromVolume3dAlgo;
getSliceFromVolume3dAlgo.setInputImage( foam );
getSliceFromVolume3dAlgo.setAxis( GetSliceFromVolume3d::Axis::X_AXIS );
getSliceFromVolume3dAlgo.setSliceIndex( 1 );
getSliceFromVolume3dAlgo.execute();

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

get_slice_from_volume_3d_algo = imagedev.GetSliceFromVolume3d()
get_slice_from_volume_3d_algo.input_image = foam
get_slice_from_volume_3d_algo.axis = imagedev.GetSliceFromVolume3d.X_AXIS
get_slice_from_volume_3d_algo.slice_index = 1
get_slice_from_volume_3d_algo.execute()

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

GetSliceFromVolume3d getSliceFromVolume3dAlgo = new GetSliceFromVolume3d
{
    inputImage = foam,
    axis = GetSliceFromVolume3d.Axis.X_AXIS,
    sliceIndex = 1
};
getSliceFromVolume3dAlgo.Execute();

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

Function Examples

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

auto result = getSliceFromVolume3d( foam, GetSliceFromVolume3d::Axis::X_AXIS, 1 );

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

result = imagedev.get_slice_from_volume_3d( foam, imagedev.GetSliceFromVolume3d.X_AXIS, 1 )

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

IOLink.ImageView result = Processing.GetSliceFromVolume3d( foam, GetSliceFromVolume3d.Axis.X_AXIS, 1 );

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