next up previous index
Next: ``threshold'' - intensity thresholding Up: Manipulation Previous: ``copy vol1 to vol2''

``two-volume ops'' - pointwise functions combining 2 volumes

VFX name:
iVolumeAlgebra.
IMPROPTU name:
Volume_Algebra.
purpose:
Perform simple arithmetic and logical pointwise operations that combine two volumes. The general form of operations possible here is the following:

\begin{displaymath}w1 * \rm v1\ \ (OP)\it\ \ w2 * \rm v2 \rightarrow v1
\end{displaymath}

where v1 and v2 are the input volumes, w1 and w2 are floating point weights, and (OP) is the pointwise function for combining the two weighted input volumes. The output goes into v1.

Among the functions available are (by toggling the menu parameter ``function = '' as shown below):

``copy vol1 to vol2'' $w1 * \rm v1 \rightarrow v2$
``gray_and vol1 and vol2'' grayscale logical AND
``gray_or vol1 and vol2'' grayscale logical OR
``gray_xor vol1 and vol2'' grayscale logical exclusive-or
``gray_min vol1 and vol2'' min$\left\{w1 * \rm v1\it ,w2 *\rm v2\right\}\rightarrow v1$
``gray_max vol1 and vol2'' max$\left\{w1 * \rm v1\it ,w2 *\rm v2\right\}\rightarrow v1$
``vol1 != vol2'' find all voxels in w1*v1 that differ from those in w2*v2
``vol1 set_diff vol2'' find the nonzero voxels in w1*v1 that differ from
those in w2*v2
``vol1 == vol2'' find the voxels in w1*v1 that equal those in w2*v2
``volume addition'' $w1 * \rm v1 \it + w2 * \rm v2 \rightarrow v1$
``volume subtraction'' $w1 * \rm v1 \it - w2 * \rm v2 \rightarrow v1$
``volume multiplic.'' $w1 * \rm v1 \it\times w2 * \rm v2 \rightarrow v1$
``volume division'' $w1 * \rm v1 \it\ / \ w2 * \rm v2 \rightarrow v1$
All operations are rounded to 8-bit arithmetic.

The functions ``volume addition'' and ``volume multiplic.'' set the result to 255 if the computed result is > 255.

The function ``volume subtraction'' sets the output to 0 if w2* v2 > w1 * v1.

The function ``volume division'' sets the output to 255 if the product w2 *v2 = 0.

The functions gray_and, gray_or, and gray_xor work as the corresponding logical operations and, or, and exclusive-or on grayscale data. Any voxel having grayscale value > 0 is treated logically as a 1; only 0 voxels are treated as logical 0's. For each pair of corresponding voxels from the two input volumes, the gray_and, gray_or, and gray_xor first check to see if the logical condition is passed; if it is, the output assumes the maximum grayscale value of the two voxels. For example, if voxel (x,y,z) assumes the values v1(x,y,z) = 100 in v1 and v2(x,y,z) = 50 in v2 and w1 2.0 and w2 = 0.5, then the gray_and, gray_or, and gray_xor output the following values:

2.0 * 100 gray_and 0.5 * 50 $\rightarrow$ 200
2.0 * 100 gray_or 0.5 * 50 $\rightarrow$ 200
2.0 * 100 gray_xor 0.5 * 50 $\rightarrow$ 0

if instead v1(x,y,z) = 0 (and all else the same), then

2.0 * 0 gray_and 0.5 * 50 $\rightarrow$ 0
2.0 * 0 gray_or 0.5 * 50 $\rightarrow$ 25
2.0 * 0 gray_xor 0.5 * 50 $\rightarrow$ 25

input:
Two different 8-bit volumes.
output:
An 8-bit volume containing the processed result.
parameters:
Default parameters menu is
function = copy vol1 to vol2
vol1_weight = 1.000
vol2_weight = 1.000
second_volume = 0
The parameter ``function = '' should be toggled to the desired function.
comments:
1.
When the weights = 1.0, the function is fairly fast (except multiply and divide). When weights differ from 1.0, the function becomes much slower.


next up previous index
Next: ``threshold'' - intensity thresholding Up: Manipulation Previous: ``copy vol1 to vol2''
MultiDimensional Image Processing Lab, Penn State University