complementcomplementComplementComplementcomplement (Operator)

Name

complementcomplementComplementComplementcomplement — Return the complement of a region.

Signature

complement(Region : RegionComplement : : )

Herror complement(const Hobject Region, Hobject* RegionComplement)

Herror T_complement(const Hobject Region, Hobject* RegionComplement)

void Complement(const HObject& Region, HObject* RegionComplement)

HRegion HRegion::Complement() const

static void HOperatorSet.Complement(HObject region, out HObject regionComplement)

HRegion HRegion.Complement()

def complement(region: HObject) -> HObject

Description

complementcomplementComplementComplementcomplement determines the complement of the input region(s).

If the system flag 'clip_region'"clip_region""clip_region""clip_region""clip_region" is 'true'"true""true""true""true", which is the default, the difference of the largest image processed so far (see reset_obj_dbreset_obj_dbResetObjDbResetObjDbreset_obj_db) and the input region is returned.

If the system flag 'clip_region'"clip_region""clip_region""clip_region""clip_region" is 'false'"false""false""false""false" (see set_systemset_systemSetSystemSetSystemset_system), the resulting region would be infinitely large. To avoid this, the complement is done only virtually by setting the complement flag of RegionRegionRegionregionregion to TRUE. For succeeding operations the de Morgan laws are applied while calculating results. Using complementcomplementComplementComplementcomplement with 'clip_region'"clip_region""clip_region""clip_region""clip_region" set to 'false'"false""false""false""false" makes sense only to avoid fringe effects, e.g., if the area of interest is bigger or smaller than the image. For the latter case, the clipping would be set explicitly. If there is no reason to use the operator with 'clip_region'"clip_region""clip_region""clip_region""clip_region"='false'"false""false""false""false" but you need the flag for other operations of your program, it is recommended to temporarily set the system flag to'true'"true""true""true""true" and change it back to 'false'"false""false""false""false" after applying complementcomplementComplementComplementcomplement. Otherwise, negative regions may result from succeeding operations.

Execution Information

Parameters

RegionRegionRegionregionregion (input_object)  region(-array) objectHRegionHObjectHObjectHobject

Input region(s).

RegionComplementRegionComplementRegionComplementregionComplementregion_complement (output_object)  region(-array) objectHRegionHObjectHObjectHobject *

Complemented regions.

Number of elements: RegionComplement == Region

Result

complementcomplementComplementComplementcomplement always returns the value 2 ( H_MSG_TRUE) . The behavior in case of empty input (no regions given) can be set via set_system('no_object_result',<Result>)set_system("no_object_result",<Result>)SetSystem("no_object_result",<Result>)SetSystem("no_object_result",<Result>)set_system("no_object_result",<Result>) and the behavior in case of an empty input region via set_system('empty_region_result',<Result>)set_system("empty_region_result",<Result>)SetSystem("empty_region_result",<Result>)SetSystem("empty_region_result",<Result>)set_system("empty_region_result",<Result>). If necessary, an exception is raised.

Possible Predecessors

thresholdthresholdThresholdThresholdthreshold, connectionconnectionConnectionConnectionconnection, regiongrowingregiongrowingRegiongrowingRegiongrowingregiongrowing, pouringpouringPouringPouringpouring, class_ndim_normclass_ndim_normClassNdimNormClassNdimNormclass_ndim_norm

Possible Successors

select_shapeselect_shapeSelectShapeSelectShapeselect_shape

See also

differencedifferenceDifferenceDifferencedifference, union1union1Union1Union1union1, union2union2Union2Union2union2, intersectionintersectionIntersectionIntersectionintersection, reset_obj_dbreset_obj_dbResetObjDbResetObjDbreset_obj_db, set_systemset_systemSetSystemSetSystemset_system

Module

Foundation