List of my modules...

Module: Convert_To_Byte

Description:

Converts a (greyscale) image (with more than 256 greylevels) to 8-bit data.

Finds a subrange of input greylevels [g0; g1[ so that all greylevels in that range will be scaled to output integer greylevels in [1:254]. All input greylevels strictly less than g0 will have output greylevel 0, all strictly greater than g1, 255.

This subrange is determined in such a way as to have a given percentage of out-of-bounds greylevels.

This percentage can be calculated on a subset of input greylevels, defined by a mask and/or region-of-interest.




Illustration of the conversion, seen with cross-sections of a CT reconstruction of an oak dowel. Top left is the raw data from the reconstruction, in 32-bit floating point greylevels. Top right is the conversion with 2% of greylevels out-of-bounds (all examples here have an equal number of pixels out-of-bounds on either end of the range, so here it's 1%+1%). Lower left is 10%, and lower right is 40%. The histogram at the bottom is that of the first conversion, i.e. with 2% out-of-bounds.

NOTES:

Connections:

Image

[required]
The input image, defined in a class HxUniformScalarField3.

ROI

[optional]
A Region Of Interest (ROI), defined in a HxSelectRoi. Will only count the pixels in the ROI if one is connected. A pixel is defined as in the ROI if the intersection between the ROI and the unit cube that defines the volume occupied by the pixel is non-empty.

Mask

[optional]
A mask image, defined in a class HxUniformScalarField3. Will only count the pixels if the corresponding pixel in the mask satisfies the threshold comparison defined in the appropriate ports.

Ports:

Mask_Threshold


If a mask is connected, this is the value to compare with the mask pixel intensity.

Mask_Comparison


If a mask is connected, defines how the mask threshold is used to define the pixels to count: should the pixel value be lower, lower or equal, greater, etc. than the mask threshold?

Crop


Percentage of greylevels to crop, both on the lower and upper ends of the greylevel range.

Convert


Push the button to convert the image.

Commands:

Additional options can be accessed when typing in the console Histogram_ COMMAND_NAME.

verbose

Displays timing information after the computation. Retype to hide info.

setCrop_f

Fraction of pixels in input image (AND in the mask AND ROI, if given) to subsample in order to compute the lower and upper threshold given in the Crop port. Fraction is in the range ]0;1]. If set to 1, all greylevels are used.

setCrop_s

The subsampling is random, the randomness is generated with a PRNG (pseudo-random number generator), which needs a seed value. You can set the seed with this command.

getCrop_f, getCrop_s

Retrieves these values mentioned above.

create

Runs the computation. Returns the name of the output, so it can be used in a script, such as set RESULT [Histogram_ create].