• The task imdiff can be used to compare two images. It finds optimum parameters (in a maximum likelihood sense) for making one image approximate another image. The parameters are an amplitude scale factor, dc offset, shifts in the x and y directions and an expansion factor. Any of these parameters can be fixed at a given value, and the others allowed to vary.

Note that this task is suited only to small shifts, expansions and scale factors. You can use the self-explanatory task shifty for large integral pixel shifts. The keyword in2 gives the image which must be adjusted to look like the image given by keyword in1. Task imdiff can also output a residual image - see the help file for the definition of the residual, but it is basically a combination of all the residuals of all the adjustable parameters.

To hold any particular parameter fixed, you simply specify the appropriate options string (see help file). Otherwise, imdiff will solve for that parameter. Initial guesses can be entered through the keyword for each parameter.

 IMDIFF in1=vela.atca Template image in2=vela.vla Adjust this image adjust=vela.vla-atca Adjusted image resid=vela.resid The residual image region Unset for entire image guard Unset for default OK xshift Unset for initial guess of 0 yshift Unset for initial guess of 0 expand Unset for initial guess of 1 amp Unset for initial guess of 1 offset Unset for initial guess of 0 options=expand Unset to vary everything and x and y expansions separately

• A very useful tool for diagnosing errors in images is to Fourier Transform them. The error may, under some conditions, be easier to recognise in the Fourier plane. Miriad offers the task fft for this purpose. It can Fourier Transform real or complex images (you input there real and imaginary parts with separate keywords). Note that blanked pixels in the input are treated as if their value was zero.

In the following example, we FFT a CLEANed image and form the amplitude and phase images of the Fourier Transform.

 FFT rin=ic4296.icln Input real image iin Unset sign=+1 Forwards transform center Use ref. pix. for centre of transform rout Unset iout Unset mag=fftp.amp Amplitude image phase=fft.phase Phase image

Task fft produces gridded images, so you can use all the usual display tools to look at them (see Chapter 17).

• For those of you wrestling with optical data in Miriad, the task impoly may be of benefit. You may like to make a polynomial sky subtraction. impoly allows you to define a region over which a 2-D polynomial is fit. The fit is the subtracted from the the full image, not just the designated fit region.

 IMPOLY in=cluster.deep Input image out=cluster-sub.deep Output image order=# Order of polynomial coeffs Unset not to see coefficients of fit region=@cgcurs.region Fit over this region

• As is discussed in Chapter 17, there are a variety of transfer functions that you can apply to your image with the display tasks. One that is particularly useful is histogram equalisation. Essentially, this method assesses, via a histogram, which image intensities have the most pixels. It then optimally expends the dynamic range of the device in displaying these pixels, rather than the pixels which have intensities that occur seldom.

It may be that you would like the image to be written out with histogram equalisation applied, rather than it just being computed but not saved by the display task. The task imheq will do this for you. You can specify the intensity range in which pixels will be included when computing the histogram. It is useful to use this if you have outliers significantly from the bulk of the distribution. imheq will equalised each plane of a cube, and by default, use the image minimum and maximum of that plane. If you set options=global it will take the minimum and maximum from the whole cube instead.

If you set the device keyword, imheq will draw a plot of the image histogram and discretized cumulative histogram (see help file). The latter is essentially the transfer function that is applied. This plot is drawn after every plane of a cube.

 IMHEQ in=cluster.deep Input image out=cluster-heq.deep Output image nbins Default for 128 histogram bins range Default is image min to max options Unset for plane by plane equalisation device=/xs PGPLOT device for histogram

• It is sometimes useful to replace the value of all image pixels which are blanked by some number (often zero). Task imblr offers this facility; it unblanks all blanked pixels and replaces their value with the one specified.

 IMBLR in=test.m1 Input image out=test-2.m1 Output image value=0.0 Replacement value