Help for RESTORW

 This procedure restores an image using the Wiener noise additive model.

 It performs the following operations:
  1. (Optional) Extract a PSF from the second input image and fourier
    transform it to obtain an OTF.
  2. Fourier transform the primary input.
  3. Perform Wiener filtering.
  4. Inverse fourier transform the result of step 3 to obtain the output
    image.

 The fourier transform steps are done using the procedure FFT22.

EXECUTION:

  restorw   (IN, PSFPIC or OTF, [OTFD])   OUT    PARAMS

  where:	IN	is the input image to be restored,
		PSFPIC  is the image containing the PSF (if MODE=PSF),
		OTF	is the optical transfer function (if MODE=OTF),
		OTFD	(optional) is the desired output OTF,
		OUT	is the restored output image,
		PARAMS  are the parameters, which are described in Tutor
			mode.
METHOD

The optional first step is only performed if MODE=PSF is specified.  (Default
is MODE=OTF).  In this step, a point spread function is extracted from the
second input image, using the AREA parameter, and is fourier transformed to 
obtain the optical transfer function (OTF).  If MODE=OTF, the OTF is the
second input file.

The image restoration is performed using program "wiener". This program applies
the Wiener noise additive restoration model on a point by point basis:

        FT2(i,j) = FT1(i,j) * W(i,j)

                        OTF"(i,j)
	W(i,j) = -----------------------
                 |OTF(i,j)|**2 + 1/SN**2

where FT1 and FT2 are the fourier transforms before and after restoration
respectively, W is the Wiener filter, OTF is the optical transfer function,
OTF" is the complex conjugate of OTF, and SN is the signal-to-noise ratio.

(NOTE:  a previous version of this proc, and of program WIENER, had a PASS
parameter that provided for iterative refinement of the output FFT, which
converged towards the reciprocal filter.  However, the same result can be
achieved by specifying a large value for parameter SN, so this was removed.)

The optional third input is the fourier transform of the desired point
spread function of the output, OTFD.  If this is specified, then the
restored transform produced by the above processing is multiplied by
this:

  FT2(final,i,j) = FT2(i,j) * OTFD(i,j)

Normally one desires a delta function PSF, and OTFD is not specified.

HISTORY

  may1985 ...lwk...  original version
  18sep90 ...lwk... replaced APFLAG/FT2/FFT22 by proc FFT2 (which
                     uses FFT2AP instead of FT2)
  26sep90 ...lwk... renamed param IDSF to SCRATCH and added it to FFT2 call
  08may95 ...ams... (CRI) MSTP S/W CONVERSION (made portable for UNIX)
  20mar03 ...lwk... removed parameter PASS (JJL did the same in WIENER)

 Current Cognizant Programmer:  L.W.Kamp


PARAMETERS:


INP

1. Primary input image. 2. PSF image or OTF. 3. (Optional) desired OTF.

OUT

restored output image.

SIZE

(SL,SS,NL,NS)

SL

Starting line.

SS

Starting sample.

NL

Number of lines.

NS

Number of samples.

SN

Signal-to noise ratio.

IFFT

File to contain fourier transform of input.

OFFT

File to contain fourier transform of output.

MODE

PSF or OTF.

PSF

File to contain point spread function. (Only if MODE=PSF)

OTF

File to contain fourier transform of PSF. (Only if MODE=PSF)

SCRATCH

Scratch file for proc FFT22.

AREA

Area of PSF image containing the PSF. (Required if MODE=PSF)

SHIFT

Allow PSF to shift? (Only if MODE=PSF)

See Examples:


Cognizant Programmer: