|
CImCombine:AlignWcs
The AlignWcs method aligns a
CImageSet collection of
CImage objects (images) to subpixel precision using
the
world coordinate system calibration of the
images. All images in the
CImageSet are aligned to one of the set members,
termed the "reference image." For each image other than the
reference image, alignment is performed by resampling all pixel
values to new fractional pixel locations that match the coordinates
of the reference image. The image data in each CImage object
is aligned "in place" and overwritten without creating a new
CImage object. Its coordinate calibration is then replaced
with the calibration of the reference image. The alignment process
does not affect the original image files unless you subsequently
save the aligned images over their original files. After alignment,
the images may be combined, processed, saved, or otherwise
analyzed. Since all images must have the same column and row
dimensions, you may wish to use the
DimEq method to test them before merging. Also see
the
AlignWcs2 and
AlignWcs3 methods which trade faster execution for
some softening of the point spread function (PSF).
Syntax
|
CImage = CImCombine:AlignWcs( CImageSet,
nRefImage=1 )
|
CImageSet contains the images to align.
nRefImage is the index of the reference image in
the
CImageSet. If not provided, index 1 is assumed as the
default.
On success,
this method returns the number of aligned images. Since the
reference image is already "aligned", this value is 1 or
greater.
On failure,
this method a negative number indicating an error.
Return Values
On success, this method returns the number of
images aligned, which is 1 or greater. On failure, a value of 0 or
less is returned, which is the value of the class nStatusCode property. An error message
corresponding to nStatusCode may be
retrieved from the class member sErrMsg. For example, if the
CImCombine class object is named C, these values are given by C.nStatusCode and C.sErrMsg.
|
nStatusCode
|
sErrMsg
|
Meaning
|
|
> 0
|
"Success"
|
The value of nStatusCode is the number of images combined,
including the reference image.
|
|
0
|
"Nothing done"
|
No arguments were passed to the AlignWcs
method.
|
|
-1
|
"Nothing done. Check the inputs"
|
The
CImageSet object passed to AlignWcs is
invalid.
|
|
-2
|
"The reference image index is outside the image
set bounds"
|
The reference image index passed to
AlignWcs is less than 1 or greater than the number of images
in the CImageSet. If no nRefValue
parameter is passed, it is assumed to be 1, by default.
|
|
-3
|
"The reference image has no WCS"
|
No world coordinate calibration was found in the
header of the reference image.
|
Example
Suppose that a
CImageSet containing 20 images is to be aligned using
the world coordinate system in image index 3. The following script
aligns all images in the Image Set. Note that the method returns
the value of the status code as described under Return
Values, above.
|
S = new_imageset()
|
|
|
|
|
|
C = new_imcombine()
|
|
|
nStatusCode = C:AlignWcs(
S, 3 )
|
|
|
if nStatusCode <= 0 then
|
|
|
Printf("Error %s\n",
C.sErrMsg)
|
|
|
end
|
|
|
S:delete()
|
|
|
C:delete()
|
|
Related Topics
CImCombine class
CImageSet
World Coordinate System
AlignWcs2
AlignWcs3
Mira Pro x64 Script User's Guide, v.8.76 Copyright Ⓒ 2024
Mirametrics, Inc. All Rights Reserved.
|