ImageDev

CropImage3d

Extracts a three-dimensional rectangular region from an image.

Access to parameter description

CropImage3d copies a rectangular area, defined by an origin and a size in voxels, from an input image $I$ and creates an output image $O$ from this selected region.

See also

Function Syntax

This function returns the outputImage output parameter.
// Function prototype.
std::shared_ptr< iolink::ImageView >
cropImage3d( std::shared_ptr< iolink::ImageView > inputImage,
             iolink::Vector3i32 areaOrigin,
             iolink::Vector3i32 areaSize,
             std::shared_ptr< iolink::ImageView > outputImage = NULL );
This function returns the outputImage output parameter.
// Function prototype.
crop_image_3d( input_image,
               area_origin = [1, 1, 1],
               area_size = [100, 100, 100],
               output_image = None )
This function returns the outputImage output parameter.
// Function prototype.
public static IOLink.ImageView
CropImage3d( IOLink.ImageView inputImage,
             int[] areaOrigin = null,
             int[] areaSize = null,
             IOLink.ImageView outputImage = null );

Class Syntax

Parameters

Class Name CropImage3d

Parameter Name Description Type Supported Values Default Value
input
inputImage
The input image. Image Binary, Label, Grayscale or Multispectral nullptr
input
areaOrigin
The origin of the area (the X, Y, and Z voxel coordinates of the input image corresponding to the output image origin). Vector3i32 >=0 {1, 1, 1}
input
areaSize
The size, in voxels, of the area (the X, Y, and Z dimensions of the output image). Vector3i32 >0 {100, 100, 100}
output
outputImage
The output image. Image nullptr

Object Examples

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

CropImage3d cropImage3dAlgo;
cropImage3dAlgo.setInputImage( foam );
cropImage3dAlgo.setAreaOrigin( {1, 1, 1} );
cropImage3dAlgo.setAreaSize( {100, 100, 100} );
cropImage3dAlgo.execute();

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

crop_image_3d_algo = imagedev.CropImage3d()
crop_image_3d_algo.input_image = foam
crop_image_3d_algo.area_origin = [1, 1, 1]
crop_image_3d_algo.area_size = [100, 100, 100]
crop_image_3d_algo.execute()

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

CropImage3d cropImage3dAlgo = new CropImage3d
{
    inputImage = foam,
    areaOrigin = new int[]{1, 1, 1},
    areaSize = new int[]{100, 100, 100}
};
cropImage3dAlgo.Execute();

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

Function Examples

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

auto result = cropImage3d( foam, {1, 1, 1}, {100, 100, 100} );

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

result = imagedev.crop_image_3d( foam, [1, 1, 1], [100, 100, 100] )

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

IOLink.ImageView result = Processing.CropImage3d( foam, new int[]{1, 1, 1}, new int[]{100, 100, 100} );

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