CImCombine:AlignWcs3


The AlignWcs3 method aligns a CImageSet collection of CImage objects (images) to pixel-level precision using the world coordinate system calibration of the images. Compared with the AlignWcs and AlignWcs2 methods, AlignWcs3 provides the fastest execution in return for resolution at the single pixel level rather than at the subpixel level. 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 AlignWcs and AlignWcs2 methods.

Syntax

CImage = CImCombine:AlignWcs3( CImageSet, nRefImage=1 )

bullet.gif    CImageSet contains the images to align.

bullet.gif    nRefImage is the index of the reference image in the CImageSet. If not provided, index 1 is assumed as the default.

bullet.gif    On success, this method returns the number of aligned images. Since the reference image is already "aligned", this value is 1 or greater.

bullet.gif    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 AlignWcs3 method.

-1

"Nothing done. Check the inputs"

The CImageSet object passed to AlignWcs3 is invalid.

-2

"The reference image index is outside the image set bounds"

The reference image index passed to AlignWcs3 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()

-- create an image set to hold the images

...

-- add images to the image set

C = new_imcombine()

-- create a CImCombine object

nStatusCode = C:AlignWcs3( S, 3 )

-- align the CImageSet members to image 3.

if nStatusCode <= 0 then

 

  Printf("Error %s\n", C.sErrMsg)

 

end

 

S:delete()

-- delete S if no longer needed

C:delete()

-- delete C if no longer needed

Related Topics

CImCombine class, CImageSet, World Coordinate System, AlignWcs, AlignWcs2


Mira Pro x64 Script User's Guide, Copyright Ⓒ 2023 Mirametrics, Inc. All Rights Reserved.