Core Optical, Inc.
DiscreteWaveletTransform ComputeForwardDWT Method Industrial Strength, Scientific Grade
Performs a forward 2D Discrete Wavelet Transform of the source data.

Namespace: PrecisionImage.WaveletProcessing
Assembly: PrecisionImage (in PrecisionImage.dll) Version: 2.0.0.0 (2.0.0.0)
Syntax

public void ComputeForwardDWT(
	SourceData sourceData,
	int sourceChannel,
	SourceData targetData,
	int targetChannel,
	Wavelet wavelet,
	int decompositionLevels
)

Parameters

sourceData
Type: PrecisionImage SourceData
A SourceData type containing the data to transform.
sourceChannel
Type: OnlineSystem Int32
An OnlineInt32 type indicating the channel containing the data to transform.
targetData
Type: PrecisionImage SourceData
A SourceData type to which the results are written. For in-place processing use the same object as the source.
targetChannel
Type: OnlineSystem Int32
An OnlineInt32 type indicating the channel in which the results are written. For in-place processing use the same channel as the source.
wavelet
Type: PrecisionImage.WaveletProcessing.Wavelets Wavelet
A Wavelet object to use when decomposing the data.
decompositionLevels
Type: OnlineSystem Int32
An OnlineInt32 type indicating the number of decomposition levels to compute.
Exceptions

ExceptionCondition
OnlineSystem NullReferenceException Thrown when sourceData, targetData or wavelet is null.
OnlineSystem ArgumentOutOfRangeException Thrown when either sourceChannel or targetChannel are negative or too large.
OnlineSystem ArgumentException Thrown when the dimensions of sourceData and targetData aren't equal.
OnlineSystem ArgumentException Thrown when either of the dimensions of the source data are not divisible by 2.
OnlineSystem ArgumentOutOfRangeException Thrown when decompositionLevels requests a decomposition level that is less than 1 or too large for the source data's dimensions.
OnlineSystem ArgumentOutOfRangeException Thrown when wavelet contains one or more filter offsets that are too large and/or too small.
Remarks

Use this method to decompose the data in a SourceData object into its two-dimensional discrete wavelet transform representation. The data is decomposed into the number of decomposition levels as specified by the decompositionLevels argument. If the data cannot be decomposed into the requested number of decomposition levels an exception will result. The minimum possible decomposition level is 1. To determine the maximum decomposition level for a given SourceData object use GetMaximumDecompositionLevels(SourceData).

To perform a forward transform in-place, specify the same SourceData object and channel for the sourceData/targetData and sourceChannel/ targetChannel arguments. If a different object is specified for targetData it must have the same dimensions as sourceData otherwise an exception will result.

Examples

The following decomposes a SourceData object in-place into the maximum number of decomposition levels using a Cohen-Daubechies-Feauveau 9/7 filter and then inverse-transforms the data back into its original state.
using PrecisionImage;
using PrecisionImage.WaveletProcessing;
using PrecisionImage.WaveletProcessing.Wavelets;

// Load the image into a SourceData object: 
Uri imageUri              = new Uri("Xray.tif", UriKind.Relative);
TiffBitmapDecoder decoder = new TiffBitmapDecoder(imageUri, BitmapCreateOptions.PreservePixelFormat, BitmapCacheOption.Default);
BitmapSource sourceImage  = decoder.Frames[0];
SourceData dataSource     = new SourceData(sourceImage, GammaEncoding.None);

// Instantiate a DWT object and the wavelet object to use with it; 
DiscreteWaveletTransform transform = new DiscreteWaveletTransform();
CDF97 wavelet = new CDF97();

// Get the maximum number of decomposition levels: 
Int32 decompLevels = transform.GetMaximumDecompositionLevels(dataSource);

// Perform a forward DWT transform in-place on the data in channel 0:
transform.ComputeForwardDWT(dataSource, 0, dataSource, 0, wavelet, decompLevels);

// Invert the data back to its original state:
transform.ComputeInverseDWT(dataSource, 0, dataSource, 0, wavelet, decompLevels);
See Also