DATAMANIP (kdatamanip) functions


LIBRARY ROUTINE

lkclip - clip or threshold values in the data object

LIBRARY CALL

int lkclip (
   kobject src_obj,
   kobject lc_obj,
   kobject uc_obj,
   double  lval,
   double  uval,
   double  fval,
   double  tval,
   int     l_flag,
   int     u_flag,
   int     use_false,
   int     use_true,
   int     op,
   kobject dst_obj)

INPUT

OUTPUT

RETURN VALUE

TRUE (1) on success, FALSE (0) on failure

DESCRIPTION

Library Routine for kclip This function clips or thresholds the values in the source object, src_obj and stores the result in the destination object, dst_obj.

Upper and/or lower cutoff values can be specified as a combination of the input constants (lval, uval) and the objects (lc_obj, uc_obj). l_flag and u_flag are flags that define which cutoffs are to be used. If no cutoffs are flagged, lkclip prints an error message and retuns FALSE. If a valid cutoff object exists, it will be used instead of the corresponding constant value.

The operation flag (op) defines whether the data should be clipped (op=0) or thresholded (op = 1).

Clipping: When clipping, if the use_false and/or use_true flags are set, the fval and/or tval passed in will be assigned as the lower result and the upper result for resulting clipped data. Otherwise, if use_false is FALSE, any data clipped to the lower cutoff is set to the lower clipping value (lower result = lc or lc_obj) instead of fval. Likewise, if use_tval is FALSE, data clipped to the upper cutoff is set to the upper clipping value (upper result = uc or uc_obj). Clipping results are assigned according to the following rules.

Clipping Assingnment Rules: 1. When lower cutoff < upper cutoff If the data value is less than the lower cutoff, set the output value to "lower result". If the data value is greater than the upper cutoff, set the output value to "upper result". Otherwise, the data value remains the same.

2. When upper cutoff < lower cutoff If the data value is less than the upper cutoff and it is greater than the lower cutoff, set output value to the "lower result". Otherwise, the data value remains the same.

Thresholding: Thresholding results are assigned according to the following rules.

Thresholding Assingnment Rules: 1. When lower cutoff < upper cutoff If the data value is less than the lower cutoff, or it is greater than the upper cutoff, set the output value to fval. Otherwise, set the output value to tval.

2. When upper cutoff < lower cutoff If the data value is less than the lower cutoff and it is greater than the upper cutoff, set output value to fval. Otherwise, set the output value to tval.

Map Data: If all source objects contain map data and no value data, the operation is done directly on the map data. If only a souce object is passed in, and it contains map data, the operation is performed directly on the map. Otherwise, if map and value data exist, the data is mapped before the operation is performed. If the destination object does not have the necessary map and/or value segments, they are created for it.

Location & Time Data: If more than one source object is supplied (src_obj, lc_obj, uc_obj), and any of them contains time or location data, lkclip will fail at this time.

Mask Data: Data is masked according to the masking mode attribute of the source data objects. The resulting object mask is the logical AND of any input masks that exist. If the destination object does not have a mask, one is created for it.

ADDITIONAL INFORMATION

none

EXAMPLES

none

SIDE EFFECTS

none

RESTRICTIONS

none

MODIFICATION

none

FILES

$DATAMANIP/objects/library/kdatamanip/src/lkclip.c

SEE ALSO

kdatamanip(3)

COPYRIGHT

Copyright (C) 1993 - 1997, Khoral Research, Inc. ("KRI") All rights reserved.