Help for FFTMAGIC

PURPOSE:
fftmagic provides an iterative method for obtaining either the phase from the
amplitude or the amplitude from the phase of a Fourier transform.  The
technique is controversial and may not work for all images. 

 
EXECUTION:

Examples

fftmagic INP=(EST,REF) OUT=PIC 

This command will read estimate picture EST and reference picture REF as byte
data (default), and create an output picture, PIC, also in byte format, whose
Fourier transform will correspond in amplitude (default) to that of REF.
Up to 100 iterations will be performed (default), and negative pixels on odd
iterations will be multiplied by -0.5 (the negative default of BETA).

fftmagic INP=(EST,REF) OUT=PIC  'OUTINTEG 'PHASE

This command is similar, except that the output picture will be in
in integer format, as specified by the OUTINTEG command, instead
of the default, which is to match the format of the input pictures; other
output format specifications include OUTREAL, OUTBYTE, and OUTHALF.  Finally,
the output picture's Fourier transform will be matched in PHASE to that of
the reference picture (REF), instead of matching amplitude as in the example
above.  The omitted keywords are INPFMT, OUTFMT, and MODE, respectively.

fftmagic INP=(EST,REF) OUT=PIC ITER=200 'PRINT  BETA=0.75

This command will again read the input pictures in byte format, but will this
time perform up to 200 iterations.  Normally, the program will iterate until no
pixels have changed, or 100 loops have been made; in this case, the program
will use up to 200 iterations.  The PRINT option specified above causes the
number of pixels changed and the sum of the negative pixels to be printed at
each iteration.  Finally, negative pixels will be multiplied by -BETA = -0.75
instead of the default -0.5.

fftmagic INP=(EST,REF) OUT=PIC PSF=(1,100,20,40)

This command demonstrates the use of the PSF keyword.  PSF specifies the
(line, sample, radius) triplets needed to describe point spread functions in 
the REF image.  These triplets are preceded by the number of triplets to be
used; in this case, there is one point spread function, centered at line 100,
sample 20, and with a radius of 40.  Additional triplets can follow as
necessary.  When PSF is specified, each center position is re-centered at the
max DN value in each circular area and the sum of the pixels less background
(determined from the border points) is computed for the values within each
circle.  The, for each iteration, all of the points inside each circle are
set to the mean DN plus the sum of the DN's as previously computed.  PSF acts
as an additional boundary condition for stellar-type point spread functions.


Notes and Restrictions

1) Both FFT's must reside in core together.  Together they take NxNx8 bytes if
   N is the picture dimension.
2) (Timing restriction belonging here will be inserted when VAX benchmarks
   have been run.)  (Was:  For 64x64 pictures each iteration consumes about
   4 seconds.)


OPERATION:
fftmagic computes and stores in core the FFT's of the initial estimate picture
and the reference picture.  It then forces the amplitude or phase of the 
estimate to match that of the reference.  The inverse FFT is taken and all
negative DN's are multiplied by -BETA (as specified by the BETA keyword) on the
odd iterations and by 0 on the even iterations.  If PSF has been specified, 
then star images are also set to delta functions.


	       EST             REF
		|		|
		|		|
		V		V
             FFT(EST)       FFT(REF)
		 \             /
		  \           /
		   \         /
		    \       /
		     \     /
		      \   /
			V
		     MATCH <------------------------------ 		     PHASE OR				  |
		     AMPLITUDE				  |
			|				  |
			|				  ^
			V			   RESET NEGATIVES
		     FFT**-1 (EST) -----------> RESET PSF'S






REFERENCE:
Fienup, J.R., Optical Society of America, Optics Letters, Volume 3, No. 1.


WRITTEN BY:  J. J. Lorre, 25 October 1979
COGNIZANT PROGRAMMER:  A. S. Mazer
REVISION:  New

MADE PORTABLE FOR UNIX: CRI     03-OCT-94


PARAMETERS:


INP

STRING - Estimate and reference pictures

OUT

STRING - Output picture

SIZE

INTEGER - Standard VICAR size field

SL

INTEGER - Starting line

SS

INTEGER - Starting sample

NS

INTEGER - Number of lines

NL

INTEGER - Number of samples

OUTFMT

KEYWORD - Output data format (OUTBYTE, OUTHALF, OUTINTEG, OUTREAL)

MODE

KEYWORD - Selects phase boundary condition (AMPLITUDE, PHASE)

ITER

INTEGER - Number of iterations allowed

PRINT

KEYWORD - Program status trace (PRINT)

BETA

REAL - Negative-pixel factor

PSF

INTEGER - Spec for point-spread functions

See Examples:


Cognizant Programmer: