ImageDev

PasteImage2d

Pastes a two-dimensional image into another at a given location.

Access to parameter description

PasteImage2d pastes an area contained in an input image $I$ at a user-defined location of an output image $O$.
If the input image does not entirely fit into the output image at the given location, only the intersecting area is pasted, and no exception occurs.

See also

Function Syntax

This function returns outputImage.
// Function prototype
std::shared_ptr< iolink::ImageView > pasteImage2d( std::shared_ptr< iolink::ImageView > inputSource, std::shared_ptr< iolink::ImageView > inputDestination, iolink::Vector2i32 originSource, iolink::Vector2i32 originDestination, iolink::Vector2u32 areaSize, std::shared_ptr< iolink::ImageView > outputImage = NULL );
This function returns outputImage.
// Function prototype.
paste_image_2d( input_source,
                input_destination,
                origin_source = [0, 0],
                origin_destination = [0, 0],
                area_size = [0, 0],
                output_image = None )
This function returns outputImage.
// Function prototype.
public static IOLink.ImageView
PasteImage2d( IOLink.ImageView inputSource,
              IOLink.ImageView inputDestination,
              int[] originSource = null,
              int[] originDestination = null,
              uint[] areaSize = null,
              IOLink.ImageView outputImage = null );

Class Syntax

Parameters

Class Name PasteImage2d

Parameter Name Description Type Supported Values Default Value
input
inputSource
The input source image to be pasted in the destination image. Image Binary, Label, Grayscale or Multispectral nullptr
input
inputDestination
The input destination image. Image Binary, Label, Grayscale or Multispectral nullptr
input
originSource
The origin of the region to paste in the destination image, expressed in pixel coordinates. If the value is set outside the image, nothing is done. Vector2i32 Any value {0, 0}
input
originDestination
The origin of the region to paste in the source image, expressed in pixel coordinates. If the value is set outside the image, nothing is done. Vector2i32 Any value {0, 0}
input
areaSize
The size of the region to select, in pixels.
If this value is set to (0, 0), the full size of the source image is used. Only source pixels lying in the overlap between both input images (after translation of the source) are pasted in the destination.
Vector2u32 Any value {0, 0}
output
outputImage
The output image where the input image is pasted. Its dimensions and type are forced to the same values as the destination input image. Image nullptr

Object Examples

std::shared_ptr< iolink::ImageView > polystyrene = ioformat::readImage( std::string( IMAGEDEVDATA_IMAGES_FOLDER ) + "polystyrene.tif" );

PasteImage2d pasteImage2dAlgo;
pasteImage2dAlgo.setInputSource( polystyrene );
pasteImage2dAlgo.setInputDestination( polystyrene );
pasteImage2dAlgo.setOriginSource( {0, 0} );
pasteImage2dAlgo.setOriginDestination( {10, 10} );
pasteImage2dAlgo.setAreaSize( {100, 100} );
pasteImage2dAlgo.execute();

std::cout << "outputImage:" << pasteImage2dAlgo.outputImage()->toString();
polystyrene = ioformat.read_image(imagedev_data.get_image_path("polystyrene.tif"))

paste_image_2d_algo = imagedev.PasteImage2d()
paste_image_2d_algo.input_source = polystyrene
paste_image_2d_algo.input_destination = polystyrene
paste_image_2d_algo.origin_source = [0, 0]
paste_image_2d_algo.origin_destination = [10, 10]
paste_image_2d_algo.area_size = [100, 100]
paste_image_2d_algo.execute()

print( "output_image:", str( paste_image_2d_algo.output_image ) )
ImageView polystyrene = ViewIO.ReadImage( @"Data/images/polystyrene.tif" );

PasteImage2d pasteImage2dAlgo = new PasteImage2d
{
    inputSource = polystyrene,
    inputDestination = polystyrene,
    originSource = new int[]{0, 0},
    originDestination = new int[]{10, 10},
    areaSize = new uint[]{100, 100}
};
pasteImage2dAlgo.Execute();

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

Function Examples

std::shared_ptr< iolink::ImageView > polystyrene = ioformat::readImage( std::string( IMAGEDEVDATA_IMAGES_FOLDER ) + "polystyrene.tif" );

auto result = pasteImage2d( polystyrene, polystyrene, {0, 0}, {10, 10}, {100, 100} );

std::cout << "outputImage:" << result->toString();
polystyrene = ioformat.read_image(imagedev_data.get_image_path("polystyrene.tif"))

result = imagedev.paste_image_2d( polystyrene, polystyrene, [0, 0], [10, 10], [100, 100] )

print( "output_image:", str( result ) )
ImageView polystyrene = ViewIO.ReadImage( @"Data/images/polystyrene.tif" );

IOLink.ImageView result = Processing.PasteImage2d( polystyrene, polystyrene, new int[]{0, 0}, new int[]{10, 10}, new uint[]{100, 100} );

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