Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

XieArithmetic(3X)  —  Subroutines

Digital

NAME

XieArithmetic − This routine creates a new image by arithmetically combining 2 source images or 1 source image and a constant image. 

C Format

dst_photo_id = XieArithmetic(src_id1, src_id2, constant, idc_id, operator, constrain)

C Argument Information

XiePhoto     dst_photo_id;
XiePhoto     src_id1;
XiePhoto     src_id2;
unsigned long  ∗constant;
XieIdc      idc_id;
unsigned long  operator;
unsigned long  constrain;

RETURN VALUES

If the src_id1 argument specifies an unbound photomap, the routine returns the newly created destination image identifier in the dst_photo_id argument. Otherwise, the routine returns the identifier of the photoflo to which the routine is appended.  You can free the photomap using the XieFreeResource routine. 

PARAMETERS

src_id1The src_id1 argument specifies the identifier of the first source image.  If the first source image is an unbound photomap, the operation is performed immediately. Otherwise, a processing element is appended to the specified photoflo with execution pending a call to the XieExecuteFlo routine.  The photoflo is specified explicitly if the first source image is a photoflo, or implicitly if the first source image is a photomap or phototap bound to the photoflo. 

src_id2The src_id2 argument specifies the second source image. If you specify a value of 0 for src_id2, the routine uses the constant image you specified for the constant argument as the second image. If you specify a photoflo for the first source image, the second source image must be bound to the specified photoflo using the XieBindMapToFlo routine. 

constantThe constant argument specifies the address of an array containing 1 constant value per component used as the second input when the value of the src_id2 argument is 0. 

idc_idThe idc_id argument specifies the identifier of the optional IDC of type CPP that defines the region of the source image or images over which the routine operates.  If you specify a value of 0, the routine operates over the entire intersection of the 2 source images. 

operatorThe operator argument specifies the type of arithmetic operation the routine performs. 

Symbol Operation Performed
XieK_AddII Adds the data in the 2 source images
XieK_AddIC Adds the constant value to the first source image
XieK_SubII Subtracts the data in the second source image from the data in the first source image
XieK_SubIC Subtracts the constant value from the data in the first source image
XieK_SubCI Subtracts the data in the first source image from the constant value
XieK_MulII Multiplies the data in the 2 source images
XieK_MulIC Multiplies the constant value by the data in the first source image
XieK_DivII Divides the data in the first source image by the data in the second source image
XieK_DivIC Divides the data in the second source image by the constant value
XieK_DivCI Divides the constant value by the data in the first source image
XieK_MinII Selects the minimum of the data in the 2 source images
XieK_MinIC Selects the minimum of the constant value and the data in the first source image
XieK_MaxII Selects the maximum of the data in the 2 source images
XieK_MaxIC Selects the maximum of the constant value and the data in the first source image

constrainThe constrain argument is a Boolean flag that indicates whether or not the routine constrains the resulting data before it is written to the destination image. If you specify True, the routine constrains the image data based on the current constraint model. If you specify False, the data remains unconstrained. 

DESCRIPTION

This routine creates a new image by arithmetically combining 2 source images or 1 source image and a constant image.  The 2 source images can be bitonal, gray scale, or multispectral and be constrained or unconstrained, but the 2 source images must have the same number of components and be spatially aligned.  If the source images are constrained, the routine first converts them to be unconstrained before performing the operation. 

If you use a constant image, you must specify the same number of components as there are in the first source image.  Each point of a component has the value supplied in the constant image array. 

The destination image has the same spatial dimensions as those of the first source image. The area over which the routine operates is the intersection of the 2 source images and the IDC, if you specify one. Any area not operated on by the routine contains the original values in the first source image. 

If the operation is performed immediately and you selected computation events using the XieSelectEvents routine, the routine adds an XieK_ComputationEvent to the X11 event queue when the routine is completed. 

XIE Events and Error Messages

Protocol Messages: X_ieArith

XIE event returned: XieK_ComputationEvent if immediate execution and computation events are selected

XieLib errors: None

XieServer errors: BadIDChoice -- Invalid identifier

BadAlloc -- Insufficient server resources

BadAccess -- 1 source image is a photoflo and the other is not bound to it

BadMatch -- The source images do not have the same number of components

BadValue -- The arithmetic operator generated an undefined value or the IDC does not intersect the source images

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026