Next: Memory requirements
Up: Using TRANSFORM structures for registration
Previous: Handling TRANSFORM structures

## Transforming position lists

As explained in the section on position lists, when a position list is associated with an image which has suitable coordinate systems attached to it, explicit transformation of positions in the list is usually not necessary, since the CCDPACK programs which use the lists will transform them into the Current coordinate system automatically.

When dealing with the old TRANSFORM-based methods however this can be required, and it may occasionally be wanted when using the new coordinate system methods, for instance for examination of image coordinates by a human or a program other than a CCDPACK one, or if position lists are still needed for some reason after the image is resampled. In these cases, the coordinates of each point in a position list can be transformed using the routine:

TRANLIST can use transformations expressed in four different forms:
• pairs of coordinate systems attached to an image
• TRANSFORM structures
• linear transform coefficients
• general algebraic expressions.
The first method uses the usual format for passing transformation information between CCDPACK applications and the second uses the format which served that purpose in previous versions of CCDPACK. The third uses the coefficients of a linear transform and the fourth allows you to transform a list using the algebraic expressions which are understood by the TRANSFORM package (SUN/61).

Transforming positions using transform structures is usually straight-forward, provided you've registered your data and entered this information into the images using REGISTER, or have added coordinate systems or TRANSFORM structures in some other way.

Transforming positions selected from one dataset (say using the IDICURS application) to a reference coordinate system (or vice-versa), is fairly straight-forward given registered datasets. It is also possible to transform to the coordinates of another dataset. The sequence of commands for this operation goes like:

% display  img                                      [1]
% idicurs  in=img outlist=img.approx                [2]
% findcent inlist=img outlist=img.acc               [3]
% tranlist trtype=wcs inlist=img framein=pixel      [4]
frameout=ccd_reg
% tranlist trtype=wcs inlist=img inext=false        [5]
outlist=img.look wcsfile=newimg
framein=pixel frameout=ccd_reg


Notes:

1. The KAPPA (SUN/95) routine DISPLAY is used for image display.
2. IDICURS is used to select positions which are written into a position list image.approx and associated with the image.
3. FINDCENT centroids the positions. The new position list is img.acc which is now associated with the image.
4. TRANLIST transforms the new positions from pixel coordinates to the CCD_REG coordinate system
5. TRANLIST now transforms the positions from pixel coordinates to the Current coordinate system of newimg.
The final command is more complex as the mapping to be used is not associated with the image with which the position list to be transformed is associated, so it is necessary to give the location of the WCS component where the coordinate system information can be found. This exemplifies why storing the transformations in a standard way that all the CCDPACK applications know about is such a good idea.

Using linear coefficients is a quick way of applying offsets, scales and rotations to data. The linear transform form is:

XX = TR(1) + TR(2) * X + TR(3) * Y
YY = TR(4) + TR(5) * X + TR(6) * Y

The TR(1-6) correspond to the coefficients you give to TRANLIST. The identity transformation is [0,1,0,0,0,1] which corresponds to the coefficients [TR(1),TR(2),TR(3),TR(4),TR(5),TR(6)]. So an offset in X and Y would be [TR(1),1,0,TR(4),0,1]. Scaling uses the TR(2,3,5, & 6) coefficients. Rotation uses the coefficients:
where is the angle to rotate (counter-clockwise). So a rotation of 45 degrees counter-clockwise about (0,0) is [0,0.7071,-0.7071,0,0.7071,0.7071].

General transformations are expressed in a Fortran-like' form and may use the functions SIN, TAN, COS, ASIN, ACOS, LOG, LOG10 and many others which are listed in SUN/61 appendix A. An example of using this capability is to transform positions by a parameterised pin-cushion distortion:

% tranlist  xfor = ( fx * ( 1 + pa * ( fx*fx + fy*fy ) ) ) * ps + px
yfor = ( fy * ( 1 + pa * ( fx*fx + fy*fy ) ) ) * ps + py
fx = ( x - px ) / ps  fy = ( y - py ) / ps
pa = 21.4 px = 100.0 py = 200.0 ps=11.5
`
This also shows how to use sub-expressions to reduce complex formulae to more manageable levels (x and y are offset and scaled to some arbitrary level and now masquerade as fx and fy). This also allows quick modifications since only the values of the parameters need to be changed on re-runs. Note that a coordinate system representing a pincushion distortion could be added instead to an image using WCSEDIT (described elsewhere).

Next: Memory requirements
Up: Using TRANSFORM structures for registration
Previous: Handling TRANSFORM structures

CCDPACK