SAS/SPECTRAVIEW Software User's Guide

# Using the Filters Provided with the Software

 Understanding the Filters

Blend filter
smooths by averaging without weighting the response value.

Gaussian filter
smooths by averaging and weights the response value.

Laplacian filter
sharpens the data.

Median filter
smooths by using the median value.

The filters are provided as templates and are preset with values that the software uses to multiply the response values. The templates differ only in their values, which you can use or modify to suit your needs. The Median filter does not provide values and cannot be modified.

Note that you can also create your own data filter, which is explained in Creating and Applying Your Own Filter.

### Blend Filter

``` 1 1 1   1 1 1   1 1 1
1 1 1   1 1 1   1 1 1
1 1 1   1 1 1   1 1 1```

Each element in the matrix has a value of 1. The multiplication does not change any values, so the response values are simply averaged to arrive at the replacement response value.

### Gaussian Filter

``` 0 0 0   0 1 0   0 0 0
0 1 0   1 4 1   0 1 0
0 0 0   0 1 0   0 0 0```

The response value being operated on is multiplied by 4, which increases (weights) it. Adjacent response values are multiplied by 1, so they are not changed. The resulting values are then averaged, with the average replacing the response value being operated on. Note that the Gaussian filter is useful to smooth out spikes in CAT scan data.

### Laplacian Filter

``` 0 0 0   0-1 0   0 0 0
0-1 0  -1 7-1   0-1 0
0 0 0   0-1 0   0 0 0```

The response value being operated on is multiplied by 7, which increases (weights) it. Adjacent response values are multiplied by -1, which decreases (pulls down) their values. The resulting values are then averaged, with the average replacing the response value being operated on. Note that the Laplacian filter is helpful for sharpening contrast in data.

### Median Filter

The Median filter sorts the response value being operated on with surrounding response values in order, selects the median value, then replaces the response value being operated on with the median value. The median value is the value in the sorted list that has the same number of values below it as above it. All 27 values, except missing values, are included in each operation.

### Combining Filters

• apply the Laplacian filter along with the Gaussian filter

• apply the Gaussian filter or Median filter along with the Laplacian filter

• apply the Laplacian filter along with the Median filter.

Note that the order in which you apply filters affects the result. That is, if you apply a Laplacian filter, then a Gaussian filter, the result will be different than if you apply the Gaussian filter first, then the Laplacian filter.

 Applying a Filter Provided with the Software

1. Load the appropriate data set.

2. Select [Data], then [Filter data].

3. Specify the filter you want to load by selecting one of the following. The default is the Blend filter.
 [Blend filter] smooths by averaging without weighting the response value. [Gaussian filter] smooths by averaging and weights the response value. [Laplacian filter] sharpens the data. [Median filter] smooths by using the median value.

4. Select [Apply filter] to apply the filter to all response values in the data.

 An Example Using the Blend Filter

The following steps illustrate the effects of applying the Blend filter:

1. Issue the following DATA step code to create a SAS data set named BUMPY, which produces a series of ellipses with additional random noise added to the response values:

```data bumpy;
do x = -5 to 5 by 0.5;
do y = -5 to 5 by 0.5;
do z = -5 to 5 by 0.5;
response = (x*x*0.5 + y*y*0.3 + z*z*0.1) + 2.0*ranuni(-1);
output;
end; end; end;
run;```

2. Load the data set into SAS/SPECTRAVIEW .

3. Create an isosurface, which represents one response value:
1. Select [Tools], then [Isosurface].

2. To specify the response value, use the left mouse button and drag the histogram's left white line to a desired value. (The histogram appears at the bottom left of the interface.)

3. Then select [W/ depth sort]. The isosurface looks something like a football that is rather bumpy.

Bumpy Isosurface

4. Next, smooth the data by applying a data filter:
1. Select [Data], then [Filter data].

2. Select [Blend filter].

3. Select [Apply filter].

5. Follow the same instructions as in Step 3 to re-create the isosurface.

The result is that removing the noise in the data displays a much smoother surface, which can help in viewing overall trends in data.

Smoother Isosurface