BC - Box Convolution

(10/10/10)

PURPOSE

Performs various contrast enhancement operations in 2D and 3D using local averaging in real space. For each point on image (IN) determine the local average (AV) of all neighboring pixels within the box size. The original image intensity at that location is then replaced by a value which is a function of the original intensity and the average of its neighbors moderated by a weighting factor (F).
Four different functions are available to compute the output pixel (OUT) intensity:

High-Pass Filtering.
OUT = (IN - AV) * F + IN * (1-F)
F = 1.0 results in a pure high-pass filtered image. Values of F between 1.0 and 0.0 result in images with various degrees of high spatial frequency enhancement.

Low-Pass Filtering.
OUT = AV * F + IN * (1 - F)
F=1.0 results in a pure low-pass filtered image. Values of F between 1.0 and 0.0 result in images with various degrees of low spatial frequency enhancement.

Local Threshold Filtering
(Restricted to images that have been previously stretched or histogram equalized).
OUT = (1-F) * IN      FOR IN   < AV
OUT = (1-F) * IN + F*2   FOR IN   >= AV
F=1.0 results in a purely threshold filtered image. Values of F between 1.0 and 0.0 result in images with various proportions of the input image added on.

Divisive Local Contrast Correction.
OUT = F * IN / (AV + EPS) + F * IN
where 'EPS' is an offset constant for avoiding zero division which is set to one tenth the global input average. F = 1.0 results in a pure divisive-corrected image. Values of F between 1.0 and 0.0 result in images with various degrees of divisive correction.]   Example.

SEE ALSO

FQ NP [Filter - Quick Fourier, High, low pass, etc, No Padding ||]
FF [Filter - Fourier]
FF PLOT [Fourier - Filter design]

USAGE

.OPERATION: BC

.INPUT FILE: IMG001
[Enter name of image/volume to be enhanced.]

.OUTPUT FILE: OUT001
[Enter name for the enhanced image.]

Following filter menu appears.
   H    HIGH PASS FILTER
   L    LOW PASS FILTER
   T    THRESHOLD FILTER
   D    DIVISIVE LOCAL FILTER

.FILTER OPTION (H,L,T,D): T
[Enter the desired convolution option.]

If the input is an image SPIDER asks:


.BOX COLUMNS & ROWS: 5, 7
[Enter X & Y dimensions of averaging box. The dimensions may be different but they both must be odd.]

If the input is a volume SPIDER asks:

.BOX COLUMNS, ROWS, & SLICES: 5, 5, 5
[Enter X, Y, & Z dimensions of averaging box. The dimensions may be different but they all must be odd.]

.FILTER WEIGHT (0.0->1.0): 0.8
[Enter weight for mixing (F).]

NOTES

  1. The margins are replaced by the nearest value possible to calculate. This can result in errors for structures filling the image close to boundaries and for large box dimensions.

SUBROUTINES

BOXX, AVERG, AVERG3

CALLER

UTIL3