ImageStackProjection3d creates a single image containing pixels transformed from a stack of input images
according to a user-defined projection criterion.
The gradient maxima projection, also known as z-stack algorithm
When acquiring a scene that is not orthogonal to the optical path (that is, not parallel to the sensor),
it is generally not possible to directly get an image focused over the whole field. Nevertheless, it is
possible to acquire several images of this scene, each one focused on a different region of the scene.
The ImageStackProjection3d algorithm can then be used to examine all images of this stack and retain the
pixel presenting the best contrast to build the resulting image.
Other pixel selection criteria
This algorithm also offers some basic selection criteria, such as intensity minimum or maximum. For instance,
selecting the maximum intensity on a CT data set can be a way to simulate a classical projection radiography.
Projection maps
When the projection mode is selective, like the intensity minima, maxima, or the gradient maxima, the algorithm
also generates an output label image that shows the contribution source selected in the result image
(the image index in the input stack).
(a)
(b)
(c)
(d)
Figure 1. Z-stack projection on a two images stack: (a) first image of the stack,
(b) second image of the stack, (c) gradient maxima projection, (d) pixel selection map
(blue: from first image, red: from second image)
Statistical criteria
Other criteria do not select a particular pixel from the stack, but computes each output value by performing an
operation on the corresponding pixel stack. The available operators are mainly first order statistics like
mean, standard deviation, energy, or entropy.
Color management
When using a selective criterion on color images, the input is converted to the HSL color space and the
criterion is evaluated on the lightness.
Other criteria cannot be applied on color image stacks, an exception is returned in this case.
This function returns a ImageStackProjection3dOutput structure containing the outputImage and outputMapImage output parameters.
/// Output structure of the ImageStackProjection3d function.publicstructImageStackProjection3dOutput{publicIOLink.ImageView outputImage;publicIOLink.ImageView outputMapImage;};// Function prototype.publicstaticImageStackProjection3dOutputImageStackProjection3d(IOLink.ImageView inputImage,ImageStackProjection3d.ProjectionMode projectionMode =ImageDev.ImageStackProjection3d.ProjectionMode.GRADIENT_MAXIMA,ImageStackProjection3d.AutoScale autoScale =ImageDev.ImageStackProjection3d.AutoScale.YES,Int32 smoothingSize =5,ImageStackProjection3d.GradientOperator gradientOperator =ImageDev.ImageStackProjection3d.GradientOperator.MORPHOLOGICAL_GRADIENT,IOLink.ImageView outputImage =null,IOLink.ImageView outputMapImage =null);
Class Syntax
// Command constructor.ImageStackProjection3d();// Get method of the inputImage parameter.
std::shared_ptr< iolink::ImageView> inputImage()const;// Set method of the inputImage parameter.void setInputImage( std::shared_ptr< iolink::ImageView> inputImage );// Get method of the projectionMode parameter.ImageStackProjection3d::ProjectionMode projectionMode()const;// Set method of the projectionMode parameter.void setProjectionMode(constImageStackProjection3d::ProjectionMode& projectionMode );// Get method of the autoScale parameter.ImageStackProjection3d::AutoScale autoScale()const;// Set method of the autoScale parameter.void setAutoScale(constImageStackProjection3d::AutoScale& autoScale );// Get method of the smoothingSize parameter.int32_t smoothingSize()const;// Set method of the smoothingSize parameter.void setSmoothingSize(constint32_t& smoothingSize );// Get method of the gradientOperator parameter.ImageStackProjection3d::GradientOperator gradientOperator()const;// Set method of the gradientOperator parameter.void setGradientOperator(constImageStackProjection3d::GradientOperator& gradientOperator );// Get method of the outputImage parameter.
std::shared_ptr< iolink::ImageView> outputImage()const;// Set method of the outputImage parameter.void setOutputImage( std::shared_ptr< iolink::ImageView> outputImage );// Get method of the outputMapImage parameter.
std::shared_ptr< iolink::ImageView> outputMapImage()const;// Set method of the outputMapImage parameter.void setOutputMapImage( std::shared_ptr< iolink::ImageView> outputMapImage );// Method to launch the command.void execute();
// Property of the inputImage parameter.ImageStackProjection3d.input_image
// Property of the projectionMode parameter.ImageStackProjection3d.projection_mode
// Property of the autoScale parameter.ImageStackProjection3d.auto_scale
// Property of the smoothingSize parameter.ImageStackProjection3d.smoothing_size
// Property of the gradientOperator parameter.ImageStackProjection3d.gradient_operator
// Property of the outputImage parameter.ImageStackProjection3d.output_image
// Property of the outputMapImage parameter.ImageStackProjection3d.output_map_image
// Method to launch the command.
execute()
// Command constructor.ImageStackProjection3d()// Property of the inputImage parameter.ImageStackProjection3d.inputImage
// Property of the projectionMode parameter.ImageStackProjection3d.projectionMode
// Property of the autoScale parameter.ImageStackProjection3d.autoScale
// Property of the smoothingSize parameter.ImageStackProjection3d.smoothingSize
// Property of the gradientOperator parameter.ImageStackProjection3d.gradientOperator
// Property of the outputImage parameter.ImageStackProjection3d.outputImage
// Property of the outputMapImage parameter.ImageStackProjection3d.outputMapImage
// Method to launch the command.Execute()
Parameters
Class Name
ImageStackProjection3d
Parameter Name
Description
Type
Supported Values
Default Value
inputImage
A 3D volume representing a stack of 2D images.
Image
Binary, Label, Grayscale or Multispectral
nullptr
projectionMode
The projection criterion (the rule used to transform a stack of pixels into a single pixel).
INTENSITY_MAXIMA
The pixel of highest intensity is selected in the stack. The map output is available with this mode.
GRADIENT_MAXIMA
The pixel of highest gradient is selected in the stack. The gradient is computed as defined by the gradientOperator parameter. The map output is available with this mode.
PROJECTION
The pixels of the stack are added up. If the autoScale mode is enabled, the result is normalized by the number of images of the stack, which is exactly the same as using the MEAN criterion. The map output is not available with this mode.
INTENSITY_MINIMA
The pixel of lowest intensity is selected in the stack. The map output is available with this mode.
MEDIAN
The pixel of median intensity is selected in the stack. The map output is not available with this mode.
MEAN
The pixels of the stack are averaged. The map output is not available with this mode.
VARIANCE
The output value is the standard deviation of the stack values. The map output is not available with this mode.
ENTROPY
The output value is the entropy of the stack values, based on this formula: Entropy=−∑i∈seqP(xi)log(P(xi)) where P(xi) is the probability to have a pixel with value xi (it's the number of those pixels divided by the total number of pixels). The map output is not available with this mode.
ENERGY
The output value is the energy of the stack values, based on this formula: Energy=∑i∈seqP(xi)2 The map output is not available with this mode.
Enumeration
GRADIENT_MAXIMA
autoScale
The automatic intensity scaling mode to average the pixels of the stack. It is used only with the PROJECTION mode and is ignored with any other criterion.
NO
The sum of intensities is not divided by the number of images in the stack.
YES
The sum of intensities is divided by the number of images in the stack.
Enumeration
YES
smoothingSize
The kernel size for smoothing the gradient before selecting the output value. It is used only with the GRADIENT_MAXIMA mode and is ignored with any other criterion.
Int32
>=0
5
gradientOperator
The gradient operator to apply.It is used only with the GRADIENT_MAXIMA mode and is ignored with any other criterion.
GAUSSIAN_GRADIENT
A gaussian gradient is performed (convolution with derivatives of gaussian function along the stack direction).
MORPHOLOGICAL_GRADIENT
A morphological gradient is performed (see MorphologicalGradient for definition). This is the recommended operator to use.
RECURSIVE_GRADIENT
A recursive gradient is performed (Canny-Deriche on stack direction).
Enumeration
MORPHOLOGICAL_GRADIENT
outputImage
The output image representing the volume projection according to the selected criterion.
Image
nullptr
outputMapImage
The output map label image. Each pixel intensity represents the Z index used in the output image.