Consider two images which have been calibrated by attaching FrameSets
to them, such that the base Frame of each FrameSet corresponds to the
raw data grid coordinates of each image (the GRID domain of
). Suppose, also, that these FrameSets
contain an unknown number of other Frames, representing alternative
world coordinate systems. What we wish to do is register these two
images, such that we can transform from a position in the data grid of
one into the corresponding position in the data grid of the other.
This is a very practical example because images will typically be
calibrated using FrameSets in precisely this way.
The first step will probably involve making a copy of both FrameSets
(using AST_COPY--), since we will be
modifying them. Let ``frameseta'' and ``framesetb'' be pointers to
these copies. Since we want to convert between the base Frames of
these FrameSets (i.e. their data grid coordinates), the next
step is to make these Frames current. This is simply done by inverting
both FrameSets, which interchanges their base and current
Frames. astInvert will perform this task:
CALL AST_INVERT( FRAMESETA, STATUS ) CALL AST_INVERT( FRAMESETB, STATUS )
To identify the required conversion, we now use AST_CONVERT, supplying a suitable domain search path with which we would like our two images to be registered:
CVT = AST_CONVERT( FRAMESETA, FRAMESETB, 'SKY,PIXEL,GRID', STATUS ) IF ( CVT .EQ. AST__NULL ) THEN <no conversion was possible> ELSE <conversion was possible> END IF
The effects of this are:
The resulting CVT FrameSet may then be used directly
() to convert between positions in the
data grid of the first image and corresponding positions in the data
grid of the second image.
To determine which domain was used to achieve registration, we can use the fact that the Base attribute of each FrameSet is set by AST_CONVERT to indicate which intermediate Frames were used. We can therefore simply invert either FrameSet (to make its base Frame become the current one) and then enquire the Domain value:
CHARACTER * ( 20 ) DOMAIN ... CALL AST_INVERT( FRAMESETA, STATUS ) DOMAIN = AST_GETC( FRAMESETA, 'Domain', STATUS )
If conversion was successful, the result will be one of the strings
``SKY'', ``PIXEL'' or ``GRID''.
AST A Library for Handling World Coordinate Systems in Astronomy