CImage Class
The CImage class encapsulates functionality for working with images. Included in this huge class are tools for working with image files, doing image math operations, changing image geometry, making measurements, and working with header data. Additional methods for combining and merging images are found in the CImCombine class.
The Execute Script menu command may be used to open and execute a script directly from a Mira Image Window. When a script is executed from the Execute Script command, it is automatically sent a CImageView object named ParentImageView and a CImage object namedParentImage . The ParentImageView is a CImageView object that provides access to the CImageView CImageSet member and others. The ParentImage is a CImage object attached to the current image in the Image Window. You can use these names directly in the script or you can rename them, like V = ParentImageView and I = ParentImage. You can also get the individual CImage objects from the window's Image Set using CImageView:GetImage. A sample script call to be called from an Image Window is provided named Execute from Image Window test.lua.
Construction |
Object = new_image() Object = attachlist_image() Object = CImage:new() Object = CImage:AttachFromList() |
Destruction |
Object:delete() |
Non-class functions that create a new CImage object. |
|
Methods that create, copy, and delete CImage objects |
|
Methods that work directly with image colums, rows, and regions, such as setting pixel values in a row or region. |
|
Methods that work with pixel and world coordinates, distances, and measurements. |
|
Methods that perform filtering operations such as smoothing and enhancing. |
|
Methods that open files, create, save, and attach images. |
|
Methods that perform high level operations for calibrating CCD images. |
|
Methods that perform geometric operations such as scaling, rotating, expanding, etc. |
|
Methods that retrieve image properties such as name, number of columns, exposure time, filter, image type, etc. |
|
Methods that work with image headers and retrieve and set header keywords. |
|
Methods that perform mathematical operations between images and image values, including multiplication, exponentiation, etc. |
|
Methods that measure features in images including distance, angle, luminance, etc. |
|
Syntax for using CImage objects as variables to simplify the syntax of complex operations, likeI2=I4+5.2 , or I2=I3*I4-17.14 |
|
Methods that work directly with image pixel values. |
These functions are normally used to create and attach a new CImage object as an alternative to the class-based construction methods. A new CImage object is also returned by the GetImage method of the CImageView class.
Creates a new CImage object attached to an image selected from an image window on the Mira desktop. This is equivalent to the AttachFromList class method. |
|
Global function that creates a new CImage object. |
Creates a new instance of the CImage class. Various constructors are available. |
|
Deletes the instance of the CImage object and deletes its image from memory. |
|
Copies the image to a new image. |
|
Creates a new CImage and attaches an image selected from the list of images in a CImageView. |
Closes the image and deletes it from memory. |
|
Creates a new image of specified size and pixel type. |
|
Displays an image in a new image view window. |
|
Opens an image from a file. |
|
Saves the image to its file. |
|
Saves the image to a new file name by prompting the user. |
|
Saves the image to a new file name without prompting. |
|
Saves an "undo" copy of the image before making changes. |
|
Restores the "undo" copy of the image. |
Returns the number of image axes. |
|
Returns the number of bytes in the image pixel data. |
|
Returns the number of image columns. |
|
Returns the dark integration time for the image. |
|
Returns the date the image was acquired, in days. |
|
Returns the date of image acquisition as a string. |
|
DatatypeStr (obsolete) |
Returns the image pixel type as a string. The name DatatypeStr is obsolete and should not be used going forward. |
Datatype (obsolete) |
Returns the image pixel type as a numeric index. The name Datatype is obsolete and should not be used going forward. |
Returns the image exposure time in seconds. |
|
Returns the name of the filter used for image acquisition. |
|
Returns the inverse gain in electrons per ADU. |
|
Returns the type of image, usually the value of the IMAGETYP keyword. |
|
Returns true if the image is a color pixel type. |
|
Returns true if the image is an integer pixel type. |
|
Returns true if the image is a numeric pixel type. |
|
Returns true if the image is a real (floating point) pixel type. |
|
Returns the object description. |
|
Returns the image file path. |
|
Returns the number of bytes per pixel. |
|
Returns the number of pixels in the image. |
|
Returns the image pixel type as a numeric index. |
|
Returns the image pixel type as a string. |
|
Returns the number of image rows. |
|
Returns the time of image acquisition as a number of seconds. |
|
Returns the time of image acquisition as a string. |
Returns the angle formed by the line between 2 pixel coordinates. |
|
Returns the angle formed by the line between 2 world coordinates. |
|
Returns the world coordinate units for area measurements. |
|
Returns the distance between 2 world coordinates. |
|
Returns the distance between 2 pixel coordinates. |
|
Returns the world coordinate units for distance measurements. |
|
Returns as a string the distance between 2 world coordinates. |
Returns the coordinate units for an image axis. |
|
Returns the coordinate label for an image axis. |
|
Returns the image scale in world coordinates per pixel. |
|
Returns the x and y axis image scale of the x and y axis in world coordinates per pixel. |
|
Returns true if a pixel coordinate is inside the image. |
|
Returns an integer code for the type of world coordinate system ("WCS") calibration used by the image. |
|
Returns true if the image has an equatorial world coordinate calibration. |
|
Returns the pixel coordinates for world coordinates specified in decimal degrees. |
|
Returns the pixel coordinates for world coordinates specified as strings in units of "HH:MM:SS.SSS" and "-DD:MM:SS.SSS". |
|
Returns the world coordinate in degrees for pixel coordinates. |
|
Returns the world coordinate as strings in units of "HH:MM:SS.SSS" and "-DD:MM:SS.SSS" for pixel coordinates. |
Returns the coordinate of the first pixel with value >= target value. |
|
Returns the coordinate of the first pixel with value >= value or <= value 2. |
|
Returns the pixel value at a pixel coordinate in the form of a number. |
|
Returns the image value at a pixel coordinate in the form of a string. |
|
Sets the pixel value at a pixel coordinate. |
|
Sets the pixels inside a rectangular region to a specified value andnoise. |
|
Sets the pixels outside a rectangular region to a specified value and noise. |
Returns the data from an image column as a 1-dimensional array. |
|
Returns the data from an image row as a 1-dimensional array. |
|
Returns the data from an image rectangle as a 1-dimensional array. |
|
Returns the image data as a 1-dimensional array. |
|
Replaces an image column with values in a 1-d 1-dimensional array. |
|
Replaces an image row with values in a 1-d 1-dimensional array. |
|
Replaces a rectangular image region with values in a 2-d 1-dimensional array. |
|
Extracts an image consisting of a specific byte plane. |
|
Creates an image consisting of a color channel from an RGB image. |
Computes the absolute value of the image pixels. |
|
Adds an operand image. |
|
Adds Gaussian random noise to a region. |
|
Adds a numeric value. |
|
Blends the values of the image with an operand image. |
|
Blends the image values with a numeric value. |
|
Swaps the byte order of the pixels. |
|
Changes the sign of the image values. |
|
Divides by an operand image. |
|
Divides by a numeric value. |
|
Raises base e to powers specified by the image pixels. |
|
Extracts an image consisting of a specific byte plane. |
|
Computes the base-e logarithm of the pixel values. |
|
Computes the base-10 logarithm of the pixel values. |
|
Calculates the remainder of division by an operand image. |
|
Computes the remainder of division by a numeric value. |
|
Multiplies by an operand image. |
|
Multiplies by a numeric value. |
|
Returns the coordinate of the first pixel with value >= target value. |
|
Returns the coordinate of the first pixel with value >= value or <= value 2. |
|
Fits and subtracts a polynomial from the image. |
|
Fits and divides a polynomial into the image. |
|
Fit a polynomial and evaluate it in the image. |
|
Raises the image values to a power. |
|
Raises a base value to powers specified by the image pixels. |
|
Raises the image pixels to the power defined by the pixels of an operand image. |
|
Computes the reciprocal of the pixel values. |
|
Creates an image consisting of a color channel from an RGB image. |
|
Applies a linear scaling to the pixel values. |
|
Applies a polynomial intensity correction. |
|
Changes the image Pixel Type. |
|
Computes the square root of the image values. |
|
Subtracts an operand image. |
|
Subtracts a numeric value. |
|
Divides the image values into a numeric value. |
|
Subtracts the image values from a numeric value. |
Applies an affine transformation of shift, scale, and rotation. |
|
Averages pixel values into m x n super-pixels. |
|
Sums pixel values into m x n super-pixels. |
|
Crops a smaller piece from the image. |
|
Tests whether 2 images have the same dimensions. |
|
Expands the image into a larger canvas with specified border value and optional random noise. |
|
Flips the image horizontally. |
|
Imbed the image at a specific location in another image. |
|
Reorients the image in various quadrant transformations. |
|
Rotates the image 180 degrees. |
|
Rotates the image 270 degrees. |
|
Rotates the image 90 degrees. |
|
Rotates the image by an angle about its center. |
|
Rotates the image by an angle about a point. |
|
Scales the image by a magnification factor. |
|
Scales the image independently by magnification factors in the x and y directions. |
|
Shifts the image horizontally and vertically. |
|
Flips the image about its main diagonal. |
|
Flips the image vertically. |
Deletes a keyword from the image header. |
|
Returns true if the named keyword exists in the image header. |
|
Returns a properly formatted angle string for a keyword value given in degrees, minutes, and seconds. Use this for keywords not in the standard format using : as a field delimiter. |
|
Returns a DMS angle for a string keyword plus a boolean flag indicating that the keyword is in the image header. |
|
Returns a MHS time string for a string keyword value given in hours, minutes, and seconds. Use this for keywords not in the standard format using : as a field delimiter. |
|
Returns an HMS time for a string keyword plus a boolean flag indicating that the keyword is in the image header. |
|
Returns a numeric value keyword. |
|
Returns a numeric value keyword plus a boolean flag indicating that the keyword is in the image header. |
|
Returns the 4 column and row limits stored in a region section keyword, like BIASSEC. |
|
Returns the 4 column and row limits stored in a region section keyword (e.g., BIASSEC), plus a boolean flag indicating that the keyword is in the image header. |
|
Returns a string value keyword. |
|
Returns a string value keyword plus a boolean flag indicating that the keyword is in the image header. |
|
Returns the value of a keyword in any format (string, number, etc.) as a string. |
|
Returns the value of a keyword in any format (string, number, etc.) as a string and also a boolean flag indicating that the keyword is in the header. |
|
Adds a blank keyword to the image header. |
|
Adds a blank keyword with string value to the image header. |
|
Sets the value of a boolean T/F keyword or adds the keyword to the image header. |
|
Adds a comment keyword to the image header. |
|
Sets the value of a date keyword or adds the keyword to the image header. |
|
Adds a history keyword to the image header. |
|
Sets the value of a numeric keyword or adds the keyword to the image header. |
|
Sets a region section keyword (e.g., BIASSEC) using the 4 column and row limits passed as numbers |
|
Sets the value of a string keyword or adds the keyword to the image header. |
|
Sets the value of a time keyword or adds the keyword to the image header. |
|
Sets the value of a keyword or adds the keyword to the image header. |
Applies a pixel mask to repair image blemishes. |
|
Creates a mask file for pixels above or below threshold values. |
|
Creates a mask file for pixels above a threshold value. |
|
Creates a mask file for pixels below a threshold value. |
|
Sets pixel values at coordinates identified in a pixel mask. |
|
Subtract a bias frame from the image. |
|
Subtract a bias value from the image. |
|
Subtract a reference bias value stored in a header keyword. |
|
Compute and apply a column bias correction. |
|
Compute and apply a row bias correction. |
|
Subtracts a dark frame from the image. |
|
Subtracts a time-scaled dark frame from the image. |
|
Subtracts a statistically optimized dark frame from the image. |
|
Divides the image by a flat field frame. |
|
Divides the image by a flat field frame while normalizing the flat during the calculation. |
Smooths the image using a binomial weight rectangular kernel. |
|
Block averages pixels in m x n rectangle groups, similar to binning a digital detector. |
|
Block sums pixels in m x n rectangle groups, similar to binning a digital detector. |
|
Replaces pixel values above a threshold value. |
|
Replaces pixel values below a threshold value. |
|
Smooths the image using an equal weight elliptical kernel. |
|
Smooths the image using a Gaussian weight elliptical kernel. |
|
Applies a directional derivative gradient filter. |
|
Applies a user-defined kernel. |
|
Applies a Laplacian filter, usually for edge detection. |
|
Applies a directional line selection kernel. |
|
Applies a maximum value filter. |
|
Applies a median filter. |
|
Applies a minimum value filter. |
|
Applies a Prewitt directional gradient mask. |
|
Applies a rank value filter. |
|
Smooths the image using an equal weight rectangular kernel. |
|
Applies a rotational gradient filter to enhance rotational or "spoked" features. |
|
Sharpens the image using a crispening filter. |
|
Applies a Sobel edge filter. |
|
Sharpens the image using unsharp masking. |
Script Classes, CImageSet class, CImageView , CImCombine class, Image Coordinate System, Subpixel Coordinate Definition
Mira Pro x64 Script User's Guide, Copyright Ⓒ 2023 Mirametrics,
Inc. All Rights Reserved.