int lkgate(
kobject src1_obj,
kobject src2_obj,
kobject gate_obj,
double gate_value,
int gate_logic,
int use_subpos,
kobject dest_obj)
gate_value kgate will compare the elements of gate_obj against gate_value, and will gate based on whether the values in gate_obj are equal/unequal to gate_value. How the gating is applied depends on the gate_logic parameter, described below.
gate_logic TRUE When gate_logic is TRUE, the following rule applies: If the value in gate_obj equals gate_value, the result copied into dest_obj will be from src2_obj, otherwise the result will be copied from src1_obj.
gate_logic FALSE When gate_logic is FALSE, the following rule applies: If the value in gate_obj equals gate_value, the result copied into dest_obj will be from src1_obj, otherwise the result will be copied from src2_obj.
use_subpos If use_subpos is TRUE, then the subobject position of each object will be applied. This includes its use in calculating the destination object size. The subobject position functionality is disabled if use_subpos is FALSE.
Data Type If the gate object is complex, only the real component will be used.
The data type of the output object's data is cast to the highest order data type of the input objects' data. Internally, the data is processed using one of the following: unsigned byte, long, unsigned long, double, or double complex. Data is not cast to a lower type for processing.
Map Data If any input object contains map data as well as value data, then the value data is mapped through the map before the operation is performed. The output object will contain value data with no associated map, and its data type is the highest of the input (map) data types.
Validity Mask If there is a validity mask associated with either source object, the destination object mask value will be assigned according to the same rules as apply to gating the value data.
Important: The Gating object may contain mask data or value data, but not both. If mask data is supplied in the gating object, it will be used only as gate values, and will not be propagated as a mask to the output object.
Source Objects of Different Sizes - Resizing & Padding The input objects can be of different sizes. If the sizes are different, the size of the output object's data will be the maximum of the data sizes of the input objects. When resizing, the input data are padded with a constant value that is defined internally by the operation being performed. If the input objects have map data as well as value data, the maximum data size is determined after mapping.
The subobject position for each source object that has value or mask data is used to determine the minimum common subobject position between them. This minimum position, along with the individual subobject positions, is used when calculating the final destination object size. Size and offsets are calculated so that the subobject positions of the source objects are aligned. These changes are applied before the operation is performed.
The resulting subobject position attribute of the destination object will be be the minimum common subobject position described above.
The subobject position attribute of a data object defines the coordinates at which that subobject was located in its parent data object. This attribute may be automatically set by programs such as the Extract operator (DATAMANIP::kextract), or it can be explicitly set by using the Set Data Attributes operator (DATAMANIP::ksetdattr). The subobject position coordinates can be printed using the Print File Information operator (DATAMANIP::kfileinfo).
Padding: If src1_obj and/or src2_obj are enlarged, the value and/or map data will be zero padded; masks will be padded with ones. If the gating object is enlarged, it will be padded with a value unequal to the gating value.
Explicit Location and Time Data This routine does not interpret location or time data. Rather, it operates on the implicit data space defined by the organization of the data. Therefore, if more than one input object is supplied, and location or time data exist, the first input object will be the dominant object, and all attributes will be transferred from the first object to the output object (regardless of whether the other inputs have location or time data). Padding or truncation of explicit location data may occur if the resulting output object size is different from the size of input 1.
If the first input object does not contain location or time data, but another input object does contain it, the location or time data will not be propagated.
Failure Modes This program can only operate on input objects if all have value data (either or both can have optional map data) or if all fIonlyfP have map data.
none
none
$DATAMANIP/objects/library/kdatamanip/src/lkgate.c