ImageDev

RadialGradientLabel2d

Performs a two-dimensional gradient projection with a directional vector defined by a set of object centers of a label image.

Access to parameter description

For an introduction: The RadialGradientLabel2d algorithm performs a gradient projection by computing the directional vector from all centers of the objects in the input label image. For a pixel $P$ in the image, the center $C$ taken into account is the center of the closest object label.

Notices: See also

Function Syntax

This function returns a RadialGradientLabel2dOutput structure containing outputNormalImage and outputTangentImage.
// Output structure of the radialGradientLabel2d function.
struct RadialGradientLabel2dOutput
{
    /// The normal gradient output image.
    std::shared_ptr< iolink::ImageView > outputNormalImage;
    /// The tangent gradient output image.
    std::shared_ptr< iolink::ImageView > outputTangentImage;
};

// Function prototype
RadialGradientLabel2dOutput radialGradientLabel2d( std::shared_ptr< iolink::ImageView > inputImageX, std::shared_ptr< iolink::ImageView > inputImageY, std::shared_ptr< iolink::ImageView > inputMarkerImage, RadialGradientLabel2d::ProjectionMode projectionMode, std::shared_ptr< iolink::ImageView > outputNormalImage = nullptr, std::shared_ptr< iolink::ImageView > outputTangentImage = nullptr );
This function returns a tuple containing output_normal_image and output_tangent_image.
// Function prototype.
radial_gradient_label_2d(input_image_x: idt.ImageType,
                         input_image_y: idt.ImageType,
                         input_marker_image: idt.ImageType,
                         projection_mode: RadialGradientLabel2d.ProjectionMode = RadialGradientLabel2d.ProjectionMode.GRADIENT_NORMAL,
                         output_normal_image: idt.ImageType = None,
                         output_tangent_image: idt.ImageType = None) -> Tuple[idt.ImageType, idt.ImageType]
This function returns a RadialGradientLabel2dOutput structure containing outputNormalImage and outputTangentImage.
/// Output structure of the RadialGradientLabel2d function.
public struct RadialGradientLabel2dOutput
{
    /// The normal gradient output image.
    public IOLink.ImageView outputNormalImage;
    /// The tangent gradient output image.
    public IOLink.ImageView outputTangentImage;
};

// Function prototype.
public static RadialGradientLabel2dOutput
RadialGradientLabel2d( IOLink.ImageView inputImageX,
                       IOLink.ImageView inputImageY,
                       IOLink.ImageView inputMarkerImage,
                       RadialGradientLabel2d.ProjectionMode projectionMode = ImageDev.RadialGradientLabel2d.ProjectionMode.GRADIENT_NORMAL,
                       IOLink.ImageView outputNormalImage = null,
                       IOLink.ImageView outputTangentImage = null );

Class Syntax

Parameters

Parameter Name Description Type Supported Values Default Value
input
inputImageX
The X-gradient input image. Image Grayscale or Multispectral nullptr
input
inputImageY
The Y-gradient input image. Image Grayscale or Multispectral nullptr
input
inputMarkerImage
The marker input image of the label objects to consider as centers. Image Label nullptr
input
projectionMode
The output images to be computed.
GRADIENT_NORMAL The engine computes the normal gradient. Only the outputNormalImage output is set using this mode.
GRADIENT_NORMAL_TANGENTIAL The engine computes the normal and tangential gradients. Both outputNormalImage and outputTangentImage outputs are set using this mode.
Enumeration GRADIENT_NORMAL
output
outputNormalImage
The normal gradient output image. Image nullptr
output
outputTangentImage
The tangent gradient output image. Image nullptr
Parameter Name Description Type Supported Values Default Value
input
input_image_x
The X-gradient input image. image Grayscale or Multispectral None
input
input_image_y
The Y-gradient input image. image Grayscale or Multispectral None
input
input_marker_image
The marker input image of the label objects to consider as centers. image Label None
input
projection_mode
The output images to be computed.
GRADIENT_NORMAL The engine computes the normal gradient. Only the outputNormalImage output is set using this mode.
GRADIENT_NORMAL_TANGENTIAL The engine computes the normal and tangential gradients. Both outputNormalImage and outputTangentImage outputs are set using this mode.
enumeration GRADIENT_NORMAL
output
output_normal_image
The normal gradient output image. image None
output
output_tangent_image
The tangent gradient output image. image None
Parameter Name Description Type Supported Values Default Value
input
inputImageX
The X-gradient input image. Image Grayscale or Multispectral null
input
inputImageY
The Y-gradient input image. Image Grayscale or Multispectral null
input
inputMarkerImage
The marker input image of the label objects to consider as centers. Image Label null
input
projectionMode
The output images to be computed.
GRADIENT_NORMAL The engine computes the normal gradient. Only the outputNormalImage output is set using this mode.
GRADIENT_NORMAL_TANGENTIAL The engine computes the normal and tangential gradients. Both outputNormalImage and outputTangentImage outputs are set using this mode.
Enumeration GRADIENT_NORMAL
output
outputNormalImage
The normal gradient output image. Image null
output
outputTangentImage
The tangent gradient output image. Image null

Object Examples

auto polystyrene = ioformat::readImage( std::string( IMAGEDEVDATA_IMAGES_FOLDER ) + "polystyrene.tif" );
auto polystyrene_sep_label = readVipImage( std::string( IMAGEDEVDATA_IMAGES_FOLDER ) + "polystyrene_sep_label.vip" );

RadialGradientLabel2d radialGradientLabel2dAlgo;
radialGradientLabel2dAlgo.setInputImageX( polystyrene );
radialGradientLabel2dAlgo.setInputImageY( polystyrene );
radialGradientLabel2dAlgo.setInputMarkerImage( polystyrene_sep_label );
radialGradientLabel2dAlgo.setProjectionMode( RadialGradientLabel2d::ProjectionMode::GRADIENT_NORMAL );
radialGradientLabel2dAlgo.execute();

std::cout << "outputNormalImage:" << radialGradientLabel2dAlgo.outputNormalImage()->toString();
std::cout << "outputTangentImage:" << radialGradientLabel2dAlgo.outputTangentImage()->toString();
polystyrene = ioformat.read_image(imagedev_data.get_image_path("polystyrene.tif"))
polystyrene_sep_label = imagedev.read_vip_image(imagedev_data.get_image_path("polystyrene_sep_label.vip"))

radial_gradient_label_2d_algo = imagedev.RadialGradientLabel2d()
radial_gradient_label_2d_algo.input_image_x = polystyrene
radial_gradient_label_2d_algo.input_image_y = polystyrene
radial_gradient_label_2d_algo.input_marker_image = polystyrene_sep_label
radial_gradient_label_2d_algo.projection_mode = imagedev.RadialGradientLabel2d.GRADIENT_NORMAL
radial_gradient_label_2d_algo.execute()

print("output_normal_image:", str(radial_gradient_label_2d_algo.output_normal_image))
print("output_tangent_image:", str(radial_gradient_label_2d_algo.output_tangent_image))
ImageView polystyrene = ViewIO.ReadImage( @"Data/images/polystyrene.tif" );
ImageView polystyrene_sep_label = Data.ReadVipImage( @"Data/images/polystyrene_sep_label.vip" );

RadialGradientLabel2d radialGradientLabel2dAlgo = new RadialGradientLabel2d
{
    inputImageX = polystyrene,
    inputImageY = polystyrene,
    inputMarkerImage = polystyrene_sep_label,
    projectionMode = RadialGradientLabel2d.ProjectionMode.GRADIENT_NORMAL
};
radialGradientLabel2dAlgo.Execute();

Console.WriteLine( "outputNormalImage:" + radialGradientLabel2dAlgo.outputNormalImage.ToString() );
Console.WriteLine( "outputTangentImage:" + radialGradientLabel2dAlgo.outputTangentImage.ToString() );

Function Examples

auto polystyrene = ioformat::readImage( std::string( IMAGEDEVDATA_IMAGES_FOLDER ) + "polystyrene.tif" );
auto polystyrene_sep_label = readVipImage( std::string( IMAGEDEVDATA_IMAGES_FOLDER ) + "polystyrene_sep_label.vip" );

auto result = radialGradientLabel2d( polystyrene, polystyrene, polystyrene_sep_label, RadialGradientLabel2d::ProjectionMode::GRADIENT_NORMAL );

std::cout << "outputNormalImage:" << result.outputNormalImage->toString();
std::cout << "outputTangentImage:" << result.outputTangentImage->toString();
polystyrene = ioformat.read_image(imagedev_data.get_image_path("polystyrene.tif"))
polystyrene_sep_label = imagedev.read_vip_image(imagedev_data.get_image_path("polystyrene_sep_label.vip"))

result_output_normal_image, result_output_tangent_image = imagedev.radial_gradient_label_2d(polystyrene, polystyrene, polystyrene_sep_label, imagedev.RadialGradientLabel2d.GRADIENT_NORMAL)

print("output_normal_image:", str(result_output_normal_image))
print("output_tangent_image:", str(result_output_tangent_image))
ImageView polystyrene = ViewIO.ReadImage( @"Data/images/polystyrene.tif" );
ImageView polystyrene_sep_label = Data.ReadVipImage( @"Data/images/polystyrene_sep_label.vip" );

Processing.RadialGradientLabel2dOutput result = Processing.RadialGradientLabel2d( polystyrene, polystyrene, polystyrene_sep_label, RadialGradientLabel2d.ProjectionMode.GRADIENT_NORMAL );

Console.WriteLine( "outputNormalImage:" + result.outputNormalImage.ToString() );
Console.WriteLine( "outputTangentImage:" + result.outputTangentImage.ToString() );