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 outputImage and outputMapImage.
// Output structure of the imageStackProjection3d function.structImageStackProjection3dOutput{/// The output image representing the volume projection according to the selected criterion.
std::shared_ptr< iolink::ImageView> outputImage;/// The output map label image. Each pixel intensity represents the Z index used in the output image.
std::shared_ptr< iolink::ImageView> outputMapImage;};// Function prototype ImageStackProjection3dOutput
imageStackProjection3d( std::shared_ptr< iolink::ImageView> inputImage,ImageStackProjection3d::ProjectionMode projectionMode,ImageStackProjection3d::AutoScale autoScale,int32_t smoothingSize,ImageStackProjection3d::GradientOperator gradientOperator,
std::shared_ptr< iolink::ImageView> outputImage = NULL,
std::shared_ptr< iolink::ImageView> outputMapImage = NULL );
This function returns a ImageStackProjection3dOutput structure containing outputImage and outputMapImage.
/// Output structure of the ImageStackProjection3d function.publicstructImageStackProjection3dOutput{/// /// The output image representing the volume projection according to the selected criterion./// publicIOLink.ImageView outputImage;/// /// The output map label image. Each pixel intensity represents the Z index used in the output image./// 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();/// Gets the inputImage parameter./// A 3D volume representing a stack of 2D images.
std::shared_ptr< iolink::ImageView> inputImage()const;/// Sets the inputImage parameter./// A 3D volume representing a stack of 2D images.void setInputImage( std::shared_ptr< iolink::ImageView> inputImage );/// Gets the projectionMode parameter./// The projection criterion (the rule used to transform a stack of pixels into a single pixel).ImageStackProjection3d::ProjectionMode projectionMode()const;/// Sets the projectionMode parameter./// The projection criterion (the rule used to transform a stack of pixels into a single pixel).void setProjectionMode(constImageStackProjection3d::ProjectionMode& projectionMode );/// Gets the autoScale parameter./// 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.ImageStackProjection3d::AutoScale autoScale()const;/// Sets the autoScale parameter./// 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.void setAutoScale(constImageStackProjection3d::AutoScale& autoScale );/// Gets the smoothingSize parameter./// 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_t smoothingSize()const;/// Sets the smoothingSize parameter./// 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.void setSmoothingSize(constint32_t& smoothingSize );/// Gets the gradientOperator parameter./// The gradient operator to apply.It is used only with the GRADIENT_MAXIMA mode and is ignored with any other criterion.ImageStackProjection3d::GradientOperator gradientOperator()const;/// Sets the gradientOperator parameter./// The gradient operator to apply.It is used only with the GRADIENT_MAXIMA mode and is ignored with any other criterion.void setGradientOperator(constImageStackProjection3d::GradientOperator& gradientOperator );/// Gets the outputImage parameter./// The output image representing the volume projection according to the selected criterion.
std::shared_ptr< iolink::ImageView> outputImage()const;/// Sets the outputImage parameter./// The output image representing the volume projection according to the selected criterion.void setOutputImage( std::shared_ptr< iolink::ImageView> outputImage );/// Gets the outputMapImage parameter./// The output map label image. Each pixel intensity represents the Z index used in the output image.
std::shared_ptr< iolink::ImageView> outputMapImage()const;/// Sets the outputMapImage parameter./// The output map label image. Each pixel intensity represents the Z index used in the output image.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
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.
Image
nullptr
Parameter Name
Description
Type
Supported Values
Default Value
input_image
A 3D volume representing a stack of 2D images.
image
Binary, Label, Grayscale or Multispectral
None
projection_mode
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
auto_scale
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
smoothing_size
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
gradient_operator
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
output_image
The output image representing the volume projection according to the selected criterion.
image
None
output_map_image
The output map label image. Each pixel intensity represents the Z index used in the output image.
image
None
Parameter Name
Description
Type
Supported Values
Default Value
inputImage
A 3D volume representing a stack of 2D images.
Image
Binary, Label, Grayscale or Multispectral
null
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
null
outputMapImage
The output map label image. Each pixel intensity represents the Z index used in the output image.