xfilter

[ XITE Reference Manual | XITE home ]

Contents


Name

xfilter - filter image and display power spectra

Syntax

xfilter [<option>...] <inimage>

Description

An image, the logarithm of a chosen filter's discrete Fourier transform magnitude, the cross-section of the latter and the output (filtered) image are displayed. Refer to the options described below on how to display more of the images involved in the filtering process.

The actual filtering is performed in the Fourier domain by multiplication of the discrete Fourier transform of the input image by the discrete Fourier transform of the filter. (Actually, the FFT is not directly computed, rather the Fast Hartley transform is used because it is more effective than the FFT. The results are the same as if the FFT had been used, except for roundoff errors.)

The filter can be chosen from a menu. The initial filter can be chosen with the option -ftype (see below).

There are two main classes of filters available. One class contains realizable filters, the other contains non-realizable filters (realizable in this context means that the filters can be implemented in finite space).

The realizable filters are "lp", "hp", "bp" and "bs". These are all based on the ideal Fourier transform magnitudes of the corresponding type. For these filters, the spatial domain filter functions are known analytically and they have infinite extent in the spatial domain. (They have been found analytically by inverse Fourier transformation of the ideal Fourier domain filter functions.) In this application the spatial domain filter functions are multiplied by 2-dimensional window functions to make them realizable. The resulting realizable Fourier transform magnitudes are displayed.

The non-relizable filters are "ilp", "blp" and "elp". "ilp" is made from the ideal Fourier transform magnitude. Instead of using the analytically correct spatial domain filter function, "ilp" computes the spatial domain filter function via inverse FFT (not equal to the inverse Fourier transform on the continuous frequency domain). This sampling in the frequency domain (from continuous frequency to discrete points in the FFT) results in aliasing in the spatial domain. "blp" and "elp" have also been constructed from closed-form Fourier domain filter functions. The spatial-domain functions have been found with inverse FFT.

Options

-low cutoff
Lower cutoff frequency, normalized by the Nyquist frequency. This means that cutoff equal to 1.0 corresponds to half the sampling frequency. cutoff can be adjusted with a slider after startup. Default: 0.2.

-high cutoff
Higher cutoff frequency (normalized by the Nyquist frequency). This can be adjusted with a slider after startup. Default: 0.5.

-ftype filter-type
Type of filter. Use one of the symbols

 Full name    Short name
 ------------------------
 lowpass         lp
 highpass        hp
 bandpass        bp
 bandstop        bs
 lowpass_ideal   ilp
 butterworth_lp  blp
 exponential_lp  elp

Default: lp.

-order filter-order
For the window-based filters, this is the filter size in pixels (diameter of window function). For the Butterworth and Exponential filters, filter-order is the parameter in the formula. For the "ideal" filter, this option has no meaning. It can be adjusted with a slider after startup. Default: 41.

-wtype window-type
Type of window function to multiply with filter in the spatial domain. Use one of the symbols

 Full name    Short name
 -----------------------
 rectangle        r
 bartlett         b
 triangle         t
 hamming          hm
 hanning          hn

Default: hm.

-scale scale
Use this scale when displaying Fourier transform magnitudes. Refer to fftDisplay(3) for a description of this parameter. Default: 10 (which will give the power spectra in dB).

-logmin min
Set all values smaller than min after logarithmic compression (for display of Fourier magnitudes) equal to min. Default: -4.0 * scale (from option -scale).

-cmin min
Clip cross-section display of filter spectrum at min. This can be adjusted with a slider after startup. Default: -80.

-cmax max
Clip cross-section display of filter spectrum at max. This can be adjusted with a slider after startup. Default: 10.

-cminmin min
Lowest possible value for the -cmin option. Default: -200.

-cmaxmax max
Largest possible value for the -cmax option. Default: 50.

-emin min
Smallest possible eps-value for logarithmic compression of FFT magnitude. Default: 1.0e-20.

-emax max
Largest possible eps-value for logarithmic compression of FFT magnitude. Default: 0.5.

-ilin
Use linear scrollbar for eps in logarithmic compression of FFT magnitude of input. Default: Logarithmic scrollbar.

-flin
Use linear scrollbar for eps in logarithmic compression of FFT magnitude of filter. Default: Logarithmic scrollbar.

-olin
Use linear scrollbar for eps in logarithmic compression of FFT magnitude of output. Default: Logarithmic scrollbar.

-rms
Do not calculate and display the RMS difference between input and output.

-wall
Show widgets for FFT(input), filter and FFT(output) in addition to input, output, FFT(filter) and its cross-section.

-win
Do not show widget for input.

-wfin
Do not show widget for FFT(input).

-wfilt
Do not show widget for filter.

-wffilt
Do not show widget for FFT(filter).

-wout
Do not show widget for output. Also implies option -rms.

-wfout
Do not show widget for FFT(output).

-wcross
Do not show widget for cross-section of FFT(filter).

Resources

In order to specify resources, it is useful to know the hierarchy of the widgets which compose xfilter. In the notation below, indentation indicates hierarchical structure.

The following hierarchy is constructed when the default resources/options for widget layout is used.

The widgets of class XfwfButton can be replaced by class Command (from the Athena widget set) by using the ximage(3) option -widgetset or corresponding application resource.

xfilter (class XFilter)

  popup                   (class TransientShell)
    dialog                (class Dialog)
      label               (class Label)
      command             (class Command)
  colorsmenu              (class SimpleMenu)
    menuLabel             (class SmeBSB)
    backgroundcol         (class SmeBSB)
    Work-map              (class SmeBSB)
    colorsep              (class SmeLine)
    White - 256           (class SmeBSB)
    Black - 256           (class SmeBSB)
    Red - 256             (class SmeBSB)
    Green - 256           (class SmeBSB)
    Blue - 256            (class SmeBSB)
    Spectrum - 256        (class SmeBSB)
    Hue - 256             (class SmeBSB)
    Rainbow - 256         (class SmeBSB)
  overlaysmenu            (class SimpleMenu)
    menuLabel             (class SmeBSB)
    backgroundovl         (class SmeBSB)
    Std-overlay           (class SmeBSB)
    colorsep              (class SmeLine)
    White - mono          (class SmeBSB)
    Black - mono          (class SmeBSB)
  optionsmenu             (class SimpleMenu)
    menuLabel             (class SmeBSB)
    optionsmenusep        (class SmeLine)
    optionsmenuentry      (class SmeBSB)
    optionsmenuentry      (class SmeBSB)
    optionsmenuentry      (class SmeBSB)
    optionsmenusep        (class SmeLine)
    optionsmenuentry      (class SmeBSB)
    optionsmenuentry      (class SmeBSB)
    optionsmenuentry      (class SmeBSB)
  toolsmenu               (class SimpleMenu)
    menuLabel             (class SmeBSB)
    imageinfo             (class SmeBSB)
    histogram             (class SmeBSB)
    slice                 (class SmeBSB)
  inimageShell            (class TopLevelShell)
    imageForm             (class ImageForm)
      menubar             (class XfwfMenuBar)
        colors            (class XfwfPullDown)
        tools             (class XfwfPullDown)
        options           (class XfwfPullDown)
      image               (class Image)
  xfilter control panel   (class TopLevelShell)
    topContainer          (class Form)
      Filter type         (class Label)
      Filter-menu         (class MenuButton)
        Filter-menu       (class SimpleMenu)
          lowpass         (class SmeBSB)
          highpass        (class SmeBSB)
          bandpass        (class SmeBSB)
          bandstop        (class SmeBSB)
          lowpass_ideal   (class SmeBSB)
          butterworth_lp  (class SmeBSB)
          exponential_lp  (class SmeBSB)
      Low cutoff          (class Label)
      lowPrompt           (class XfwfPrompt)
      lowScroll           (class Scrollbar)
      High cutoff         (class Label)
      highPrompt          (class XfwfPrompt)
      highScroll          (class Scrollbar)
      Filter order        (class Label)
      orderPrompt         (class XfwfPrompt)
      orderScroll         (class Scrollbar)
      Window type         (class Label)
      Window-menu         (class MenuButton)
        Window-menu       (class SimpleMenu)
          rectangle       (class SmeBSB)
          bartlett        (class SmeBSB)
          triangle        (class SmeBSB)
          hamming         (class SmeBSB)
          hanning         (class SmeBSB)
      rmsDiff             (class Label)
      fInimageEpsLabel    (class Label)
      fInimageEpsPrompt   (class XfwfPrompt)
      fInimageEpsScroll   (class Scrollbar)
      fFiltimageEpsLabel  (class Label)
      fFiltimageEpsPrompt (class XfwfPrompt)
      fFiltimageEpsScroll (class Scrollbar)
      fOutimageEpsLabel   (class Label)
      fOutimageEpsPrompt  (class XfwfPrompt)
      fOutimageEpsScroll  (class Scrollbar)
      crossMinLabel       (class Label)
      crossMinPrompt      (class XfwfPrompt)
      crossMinScroll      (class Scrollbar)
      crossMaxLabel       (class Label)
      crossMaxPrompt      (class XfwfPrompt)
      crossMaxScroll      (class Scrollbar)
      read inimage        (class XfwfButton)
      save outimage       (class XfwfButton)
      save filter         (class XfwfButton)
      quit                (class XfwfButton)

Six additional image widgets belong to the hierarchy. Their description is exactly like the one for inimageShell above, except that the resource instance names of the TopLevelShell widget is f_inimageShell, filtimageShell, f_filtimageShell, filtcrossShell, outimageShell and f_outimageShell.

See also

lowpass(1), highpass(1), bandpass(1), bandstop(1), lowpassIdeal(1), butterworth(1), exponential(1), fft2d(1), fht2d(1), ht2ft(1), fhtPower(1), logarithm(1), ximage(3), Image(3)

Files

$XITE_HOME/etc/app_defaults/XFilter

Author

Svein Bøe, Ifi, UiO

Doc

Svein Bøe

Id

$Id: xfilter.c,v 1.45 1997/07/29 08:58:16 svein Exp $