IPREAD_FILTER Function (PV-WAVE Extreme Advantage)

Reads an ASCII text or XDR file depending on whether the file contains a spatial or spectral filter (respectively).

Usage

result = IPREAD_FILTER(filename)

Input Parameters

filename—A scalar string containing the name of the filter file.

Returned Value

result—An associative array containing the filter object. The filter object associative array is described as follows:

For a spatial filter, the filter object has three strings containing the key names of elements of the associative array:

'kernel'—A 2D array of the filter spatial values.

'domain'—A string set to 'SPATIAL'.

'scale'—The scale factor.

For a spectral filter, the filter object has ten strings containing the key names of elements of the associative array:

'kernel'—A 2D array of the filter spectral values.

'domain'—A string set to 'SPECTRAL'.

'cutoff'—A one-element array (for highpass and lowpass filters), or a two-element array (for bandpass and bandstop filters) containing the filter cutoff frequency, or frequencies.

'pass'—A string indicating the filter type: 'low', 'high', 'stop', 'band', or 'notch'.

'dc_offset'—A float value containing the filter DC offset.

'co_frac'—A float value containing the fraction of the maximum filter value at the cutoff frequency.

'maximum'—A float value containing the maximum filter amplitude.

'type'—A string indicating the filter type: 'ideal', or 'Butterworth'.

'xloc'—(For notch filters only.) The x-location of the filter center.

'yloc'—(For notch filters only.) The y-location of the filter center.

'center'—If set, the filter center is at the center of the array.

'order'—(For Butterworth filters only.) A floating point value indicating the filter order.

Keywords

None.

Discussion

There are many filter files provided with the Image Processing Toolkit. The files are located in the following directories:

ip-1_0/data/kernel/*.ker
ip-1_0/data/filter/*.flt

ip-1_0\data\kernel\*.ker
ip-1_0\data\filter\*.flt

The file format for the spatial filter files provided and for user-written spatial filter files must conform to the following conventions:

Comments begin with a semicolon.

The first un-commented line in the file is the data type of the filter weights. This line is one of the following valid strings: 'byte', 'int', 'long', 'float', or 'double'.

The next un-commented line contains the dimensions of the kernel, with the x-dimension listed first, followed by the y-dimension.

Next is the list of space and/or line feed-separated kernel values.

Finally, the scale factor, if present, appears. The scale factor is a floating point value.

For spectral filters, the file format is simply the associative array saved in XDR format.

Example

In this example, the IPREAD_FILTER function is used to read in the Frei-Chen column edge gradient kernel from the directory of files provided with the Image Processing Toolkit.

freichen = IPREAD_FILTER(!IP_Data + '/kernel/' + $
'freichen_c3.ker')
result = IPCONVOL(image, freichen)

See Also

FILT_FREQ,  IPCONVOL,  IPWRITE_FILTER