ImageDev

BeamHardeningCorrection3d

Performs a beam hardening correction dedicated to cylindrical objects of a Computed Tomography volume.

Access to parameter description

This algorithm performs a simple correction for beam hardening that mainly works for homogeneous cylindrical objects. Beam hardening manifests by a radial increase of the attenuation coefficient when the X-ray beam crosses a material interface presenting a high density difference. On cylindrical material samples, like geological cores, it is materialized by an intensity peak on the cylinder border.

First, an average cylindrical intensity profile $P$ is computed around a user-defined rotation axis. Theoretically, this axis must correspond to the CT rotation axis, but it does not necessarily need to be aligned with one of the input image axis.
This profile can be smoothed with a gaussian filter, and is then normalized by the mean intensity value of the inner part of the cylindrical object.
Finally, all intensities are divided by this smoothed profile to perform a radial averaging.

The corrected value $O$ of a voxel $v$ of the input image $I$ is given by: $$ O(v) = \frac {I(v)}{P(r)}\times\mu_c$$ where $P$ is the cylindrical profile intensity, $r$ is the distance from the correction center to $v$ and $\mu_c$ the normalization factor (inner part mean intensity).

To focus the correction on phases of interest, two thresholds are proposed to This algorithm assumes that the inner part is representative of the whole object to compute the normalization factor, and therefore this correction should be applied only to fairly homogeneous samples.



<b> (a) </b>
(a)
<b> (b) </b>
(b)
Figure 1. (a) Original CT image with beam hardening and line profile from image
center (left of the curve) to exterior (right). (b) Corrected image with ring artifact removal filter.


See also

Function Syntax

This function returns the outputImage output parameter.
// Function prototype.
std::shared_ptr< iolink::ImageView >
beamHardeningCorrection3d( std::shared_ptr< iolink::ImageView > inputImage,
                           BeamHardeningCorrection3d::AxisDirection axisDirection,
                           BeamHardeningCorrection3d::AxisOrientation axisOrientation,
                           BeamHardeningCorrection3d::CenterMode centerMode,
                           iolink::Vector3u32 mainCenter,
                           iolink::Vector3u32 secondaryCenter,
                           double radiusPercentage,
                           iolink::Vector2u32 radiusRange,
                           iolink::Vector2d thresholdRange,
                           double standardDeviation,
                           BeamHardeningCorrection3d::PaddingPolicy paddingPolicy,
                           double paddingValue,
                           std::shared_ptr< iolink::ImageView > outputImage = NULL );
This function returns the outputImage output parameter.
// Function prototype.
beam_hardening_correction_3d( input_image,
                              axis_direction = BeamHardeningCorrection3d.AxisDirection.Z_AXIS,
                              axis_orientation = BeamHardeningCorrection3d.AxisOrientation.STRAIGHT,
                              center_mode = BeamHardeningCorrection3d.CenterMode.IMAGE_CENTER,
                              main_center = [0, 0, 0],
                              secondary_center = [0, 0, 0],
                              radius_percentage = 25,
                              radius_range = [0, 0],
                              threshold_range = [0, 65535],
                              standard_deviation = 0,
                              padding_policy = BeamHardeningCorrection3d.PaddingPolicy.INPUT_VALUE,
                              padding_value = 0,
                              output_image = None )
This function returns the outputImage output parameter.
// Function prototype.
public static IOLink.ImageView
BeamHardeningCorrection3d( IOLink.ImageView inputImage,
                           BeamHardeningCorrection3d.AxisDirection axisDirection = ImageDev.BeamHardeningCorrection3d.AxisDirection.Z_AXIS,
                           BeamHardeningCorrection3d.AxisOrientation axisOrientation = ImageDev.BeamHardeningCorrection3d.AxisOrientation.STRAIGHT,
                           BeamHardeningCorrection3d.CenterMode centerMode = ImageDev.BeamHardeningCorrection3d.CenterMode.IMAGE_CENTER,
                           uint[] mainCenter = null,
                           uint[] secondaryCenter = null,
                           double radiusPercentage = 25,
                           uint[] radiusRange = null,
                           double[] thresholdRange = null,
                           double standardDeviation = 0,
                           BeamHardeningCorrection3d.PaddingPolicy paddingPolicy = ImageDev.BeamHardeningCorrection3d.PaddingPolicy.INPUT_VALUE,
                           double paddingValue = 0,
                           IOLink.ImageView outputImage = null );

Class Syntax

Parameters

Class Name BeamHardeningCorrection3d

Parameter Name Description Type Supported Values Default Value
input
inputImage
The 3D input image to correct. Image Grayscale or Multispectral nullptr
input
axisDirection
The axis along which the correction has to be carried out.
X_AXIS The correction is applied on YZ slices.
Y_AXIS The correction is applied on XZ slices.
Z_AXIS The correction is applied on XY slices.
Enumeration Z_AXIS
input
axisOrientation
Set the cylinder axis to be used during correction: straight or sheared. This option is ignored if the axis direction is not Z_AXIS (forced to straight).
STRAIGHT A straight axis assumes that the sample is a vertical cylinder.
SHEARED A sheared axis considers a sheared cylinder determined by the midpoints at the top and bottom of the sample.
This option is only available when the rotation axis is Z_AXIS at this stage.
Enumeration STRAIGHT
input
centerMode
The way to define the main center of the cylindrical sample. It is ignored if the axis orientation is set to SHEARED (forced to OTHER).
IMAGE_CENTER The correction center is the center of the input image.
OTHER The correction center is user-defined.
Enumeration IMAGE_CENTER
input
mainCenter
The midpoint of the sample in voxel coordinates.
With straight axis setting, this point is considered as the center of the sample.
With sheared axis setting, it is considered as the center of the first plane of the sample.
It is ignored if the axis orientation is set to STRAIGHT and center mode to IMAGE_CENTER.
Vector3u32 Any value {0, 0, 0}
input
secondaryCenter
The midpoint of the last plane of the sample in voxel coordinates (ignored with STRAIGHT axis setting).
It is only used if axis direction is Z_AXIS and the orientation is set to SHEARED.
Vector3u32 Any value {0, 0, 0}
input
radiusPercentage
The portion, in percent, of the maximum radius that is effectively considered for computing the normalization factor. The average value of the area inside this percentage of the maximum radius is used to normalize the data. Float64 [0, 100] 25
input
radiusRange
The minimum and maximum radius, in voxel units, between which the correction is done. If the maximum radius is equal to 0, the largest possible radius is used. Vector2u32 Any value {0, 0}
input
thresholdRange
Values out of this range are not included in the statistics to calculate the correction. Vector2d Any value {0.f, 65535.f}
input
standardDeviation
The standard deviation, in voxel units, of the gaussian filtering used to smooth the histogram before performing the correction. No smoothing is applied if this value is set to 0. Float64 >=0 0
input
paddingPolicy
The way to manage uncomputed values (that is, voxels that are out of the maximum radius).
INPUT_VALUE The input intensity value is transferred.
FIXED_VALUE The uncomputed area is filled with a padding value.
Enumeration INPUT_VALUE
input
paddingValue
The intensity value used to fill uncomputed voxels (that is, voxels that are out of the maximum radius). It is used only with the fixed value padding policy. Float64 Any value 0
output
outputImage
The corrected image. Its dimensions and type are forced to the same values as the input. Image nullptr

Object Examples

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

BeamHardeningCorrection3d beamHardeningCorrection3dAlgo;
beamHardeningCorrection3dAlgo.setInputImage( foam );
beamHardeningCorrection3dAlgo.setAxisDirection( BeamHardeningCorrection3d::AxisDirection::Z_AXIS );
beamHardeningCorrection3dAlgo.setAxisOrientation( BeamHardeningCorrection3d::AxisOrientation::STRAIGHT );
beamHardeningCorrection3dAlgo.setCenterMode( BeamHardeningCorrection3d::CenterMode::OTHER );
beamHardeningCorrection3dAlgo.setMainCenter( {40, 50, 0} );
beamHardeningCorrection3dAlgo.setSecondaryCenter( {0, 0, 0} );
beamHardeningCorrection3dAlgo.setRadiusPercentage( 25 );
beamHardeningCorrection3dAlgo.setRadiusRange( {0, 80} );
beamHardeningCorrection3dAlgo.setThresholdRange( {0, 255} );
beamHardeningCorrection3dAlgo.setStandardDeviation( 4 );
beamHardeningCorrection3dAlgo.setPaddingPolicy( BeamHardeningCorrection3d::PaddingPolicy::INPUT_VALUE );
beamHardeningCorrection3dAlgo.setPaddingValue( 0 );
beamHardeningCorrection3dAlgo.execute();

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

beam_hardening_correction_3d_algo = imagedev.BeamHardeningCorrection3d()
beam_hardening_correction_3d_algo.input_image = foam
beam_hardening_correction_3d_algo.axis_direction = imagedev.BeamHardeningCorrection3d.Z_AXIS
beam_hardening_correction_3d_algo.axis_orientation = imagedev.BeamHardeningCorrection3d.STRAIGHT
beam_hardening_correction_3d_algo.center_mode = imagedev.BeamHardeningCorrection3d.OTHER
beam_hardening_correction_3d_algo.main_center = [40, 50, 0]
beam_hardening_correction_3d_algo.secondary_center = [0, 0, 0]
beam_hardening_correction_3d_algo.radius_percentage = 25
beam_hardening_correction_3d_algo.radius_range = [0, 80]
beam_hardening_correction_3d_algo.threshold_range = [0, 255]
beam_hardening_correction_3d_algo.standard_deviation = 4
beam_hardening_correction_3d_algo.padding_policy = imagedev.BeamHardeningCorrection3d.INPUT_VALUE
beam_hardening_correction_3d_algo.padding_value = 0
beam_hardening_correction_3d_algo.execute()

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

BeamHardeningCorrection3d beamHardeningCorrection3dAlgo = new BeamHardeningCorrection3d
{
    inputImage = foam,
    axisDirection = BeamHardeningCorrection3d.AxisDirection.Z_AXIS,
    axisOrientation = BeamHardeningCorrection3d.AxisOrientation.STRAIGHT,
    centerMode = BeamHardeningCorrection3d.CenterMode.OTHER,
    mainCenter = new uint[]{40, 50, 0},
    secondaryCenter = new uint[]{0, 0, 0},
    radiusPercentage = 25,
    radiusRange = new uint[]{0, 80},
    thresholdRange = new double[]{0, 255},
    standardDeviation = 4,
    paddingPolicy = BeamHardeningCorrection3d.PaddingPolicy.INPUT_VALUE,
    paddingValue = 0
};
beamHardeningCorrection3dAlgo.Execute();

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

Function Examples

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

auto result = beamHardeningCorrection3d( foam, BeamHardeningCorrection3d::AxisDirection::Z_AXIS, BeamHardeningCorrection3d::AxisOrientation::STRAIGHT, BeamHardeningCorrection3d::CenterMode::OTHER, {40, 50, 0}, {0, 0, 0}, 25, {0, 80}, {0, 255}, 4, BeamHardeningCorrection3d::PaddingPolicy::INPUT_VALUE, 0 );

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

result = imagedev.beam_hardening_correction_3d( foam, imagedev.BeamHardeningCorrection3d.Z_AXIS, imagedev.BeamHardeningCorrection3d.STRAIGHT, imagedev.BeamHardeningCorrection3d.OTHER, [40, 50, 0], [0, 0, 0], 25, [0, 80], [0, 255], 4, imagedev.BeamHardeningCorrection3d.INPUT_VALUE, 0 )

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

IOLink.ImageView result = Processing.BeamHardeningCorrection3d( foam, BeamHardeningCorrection3d.AxisDirection.Z_AXIS, BeamHardeningCorrection3d.AxisOrientation.STRAIGHT, BeamHardeningCorrection3d.CenterMode.OTHER, new uint[]{40, 50, 0}, new uint[]{0, 0, 0}, 25, new uint[]{0, 80}, new double[]{0, 255}, 4, BeamHardeningCorrection3d.PaddingPolicy.INPUT_VALUE, 0 );

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