create_distance_transform_xldT_create_distance_transform_xldCreateDistanceTransformXldCreateDistanceTransformXldcreate_distance_transform_xld (Operator)

Name

create_distance_transform_xldT_create_distance_transform_xldCreateDistanceTransformXldCreateDistanceTransformXldcreate_distance_transform_xld — Create the XLD distance transform.

Signature

create_distance_transform_xld(Contour : : Mode, MaxDistance : DistanceTransformID)

Herror T_create_distance_transform_xld(const Hobject Contour, const Htuple Mode, const Htuple MaxDistance, Htuple* DistanceTransformID)

void CreateDistanceTransformXld(const HObject& Contour, const HTuple& Mode, const HTuple& MaxDistance, HTuple* DistanceTransformID)

void HXLDDistTrans::HXLDDistTrans(const HXLDCont& Contour, const HString& Mode, const HTuple& MaxDistance)

void HXLDDistTrans::HXLDDistTrans(const HXLDCont& Contour, const HString& Mode, double MaxDistance)

void HXLDDistTrans::HXLDDistTrans(const HXLDCont& Contour, const char* Mode, double MaxDistance)

void HXLDDistTrans::HXLDDistTrans(const HXLDCont& Contour, const wchar_t* Mode, double MaxDistance)   ( Windows only)

void HXLDDistTrans::CreateDistanceTransformXld(const HXLDCont& Contour, const HString& Mode, const HTuple& MaxDistance)

void HXLDDistTrans::CreateDistanceTransformXld(const HXLDCont& Contour, const HString& Mode, double MaxDistance)

void HXLDDistTrans::CreateDistanceTransformXld(const HXLDCont& Contour, const char* Mode, double MaxDistance)

void HXLDDistTrans::CreateDistanceTransformXld(const HXLDCont& Contour, const wchar_t* Mode, double MaxDistance)   ( Windows only)

static void HOperatorSet.CreateDistanceTransformXld(HObject contour, HTuple mode, HTuple maxDistance, out HTuple distanceTransformID)

public HXLDDistTrans(HXLDCont contour, string mode, HTuple maxDistance)

public HXLDDistTrans(HXLDCont contour, string mode, double maxDistance)

void HXLDDistTrans.CreateDistanceTransformXld(HXLDCont contour, string mode, HTuple maxDistance)

void HXLDDistTrans.CreateDistanceTransformXld(HXLDCont contour, string mode, double maxDistance)

def create_distance_transform_xld(contour: HObject, mode: str, max_distance: Union[int, float]) -> HHandle

Description

create_distance_transform_xldcreate_distance_transform_xldCreateDistanceTransformXldCreateDistanceTransformXldCreateDistanceTransformXldcreate_distance_transform_xld creates the XLD distance transform of the reference contour ContourContourContourContourcontourcontour and returns the resulting handle in DistanceTransformIDDistanceTransformIDDistanceTransformIDDistanceTransformIDdistanceTransformIDdistance_transform_id.

Once the XLD distance transform has been created, the operator apply_distance_transform_xldapply_distance_transform_xldApplyDistanceTransformXldApplyDistanceTransformXldApplyDistanceTransformXldapply_distance_transform_xld calculates pointwise distances from test contours to the reference contour ContourContourContourContourcontourcontour. More precisely, for each point of a test contour its minimal distance to the contours in ContourContourContourContourcontourcontour is calculated.

The parameter ModeModeModeModemodemode determines which distances apply_distance_transform_xldapply_distance_transform_xldApplyDistanceTransformXldApplyDistanceTransformXldApplyDistanceTransformXldapply_distance_transform_xld calculates: 'point_to_point'"point_to_point""point_to_point""point_to_point""point_to_point""point_to_point" calculates the minimum distance to the base points of the ContourContourContourContourcontourcontour. In contrast, 'point_to_segment'"point_to_segment""point_to_segment""point_to_segment""point_to_segment""point_to_segment" calculates the minimum distance to the contour segments in ContourContourContourContourcontourcontour (see the figure below).

The dashed lines illustrate the calculated distances starting from point 1 of the test contour on the left. The distance corresponds to the 'point_to_point'"point_to_point""point_to_point""point_to_point""point_to_point""point_to_point" mode, whereas the distance corresponds to the 'point_to_segment'"point_to_segment""point_to_segment""point_to_segment""point_to_segment""point_to_segment" mode. The gray area illustrates the area within MaxDistanceMaxDistanceMaxDistanceMaxDistancemaxDistancemax_distance around the reference contour for which distances are calculated. The distance of point 2 of the test contour would be set to MaxDistanceMaxDistanceMaxDistanceMaxDistancemaxDistancemax_distance because it is outside of this area.

The parameter MaxDistanceMaxDistanceMaxDistanceMaxDistancemaxDistancemax_distance specifies a maximum distance from the reference contour ContourContourContourContourcontourcontour which is of interest to the caller. If the distance from a point of a test contour to the reference contour exceeds MaxDistanceMaxDistanceMaxDistanceMaxDistancemaxDistancemax_distance, the output distance of apply_distance_transform_xldapply_distance_transform_xldApplyDistanceTransformXldApplyDistanceTransformXldApplyDistanceTransformXldapply_distance_transform_xld is set to MaxDistanceMaxDistanceMaxDistanceMaxDistancemaxDistancemax_distance.

The operators create_distance_transform_xldcreate_distance_transform_xldCreateDistanceTransformXldCreateDistanceTransformXldCreateDistanceTransformXldcreate_distance_transform_xld and apply_distance_transform_xldapply_distance_transform_xldApplyDistanceTransformXldApplyDistanceTransformXldApplyDistanceTransformXldapply_distance_transform_xld are an alternative to distance_contours_xlddistance_contours_xldDistanceContoursXldDistanceContoursXldDistanceContoursXlddistance_contours_xld, if the reference contour is repeatedly used. create_distance_transform_xldcreate_distance_transform_xldCreateDistanceTransformXldCreateDistanceTransformXldCreateDistanceTransformXldcreate_distance_transform_xld stores for each pixel in a relevant area around ContourContourContourContourcontourcontour its nearest points or segments (depending on ModeModeModeModemodemode) of the reference contour ContourContourContourContourcontourcontour. This allows apply_distance_transform_xldapply_distance_transform_xldApplyDistanceTransformXldApplyDistanceTransformXldApplyDistanceTransformXldapply_distance_transform_xld to calculate the distances rather fast, nearly independent of the number of points or segments of the reference contour, the ModeModeModeModemodemode and the position of the points of the test contour. However, the preparation of the XLD distance transform can take several seconds or minutes, depending on the number of points or segments of the reference contour and the relevant area around ContourContourContourContourcontourcontour which can be influenced by MaxDistanceMaxDistanceMaxDistanceMaxDistancemaxDistancemax_distance. Furthermore, create_distance_transform_xldcreate_distance_transform_xldCreateDistanceTransformXldCreateDistanceTransformXldCreateDistanceTransformXldcreate_distance_transform_xld is faster, if ModeModeModeModemodemode is set to 'point_to_point'.

get_distance_transform_xld_contourget_distance_transform_xld_contourGetDistanceTransformXldContourGetDistanceTransformXldContourGetDistanceTransformXldContourget_distance_transform_xld_contour and get_distance_transform_xld_paramget_distance_transform_xld_paramGetDistanceTransformXldParamGetDistanceTransformXldParamGetDistanceTransformXldParamget_distance_transform_xld_param can be used to get back the reference contours and the parameters of the XLD distance transform DistanceTransformIDDistanceTransformIDDistanceTransformIDDistanceTransformIDdistanceTransformIDdistance_transform_id.

Execution Information

This operator returns a handle. Note that the state of an instance of this handle type may be changed by specific operators even though the handle is used as an input parameter by those operators.

Parameters

ContourContourContourContourcontourcontour (input_object)  xld_cont(-array) objectHXLDContHObjectHXLDContHobject

Reference contour(s).

ModeModeModeModemodemode (input_control)  string HTuplestrHTupleHtuple (string) (string) (HString) (char*)

Compute the distance to points ('point_to_point') or entire segments ('point_to_segment').

Default: 'point_to_point' "point_to_point" "point_to_point" "point_to_point" "point_to_point" "point_to_point"

List of values: 'point_to_point'"point_to_point""point_to_point""point_to_point""point_to_point""point_to_point", 'point_to_segment'"point_to_segment""point_to_segment""point_to_segment""point_to_segment""point_to_segment"

MaxDistanceMaxDistanceMaxDistanceMaxDistancemaxDistancemax_distance (input_control)  real HTupleUnion[int, float]HTupleHtuple (real / integer) (double / int / long) (double / Hlong) (double / Hlong)

Maximum distance of interest.

Default: 20.0

DistanceTransformIDDistanceTransformIDDistanceTransformIDDistanceTransformIDdistanceTransformIDdistance_transform_id (output_control)  xld_dist_trans HXLDDistTrans, HTupleHHandleHTupleHtuple (handle) (IntPtr) (HHandle) (handle)

Handle of the XLD distance transform.

Result

If all parameters are correct, the operator returns the value 2 ( H_MSG_TRUE) . Otherwise, an exception is raised.

Possible Successors

apply_distance_transform_xldapply_distance_transform_xldApplyDistanceTransformXldApplyDistanceTransformXldApplyDistanceTransformXldapply_distance_transform_xld, write_distance_transform_xldwrite_distance_transform_xldWriteDistanceTransformXldWriteDistanceTransformXldWriteDistanceTransformXldwrite_distance_transform_xld, serialize_distance_transform_xldserialize_distance_transform_xldSerializeDistanceTransformXldSerializeDistanceTransformXldSerializeDistanceTransformXldserialize_distance_transform_xld, clear_distance_transform_xldclear_distance_transform_xldClearDistanceTransformXldClearDistanceTransformXldClearDistanceTransformXldclear_distance_transform_xld

See also

distance_contours_xlddistance_contours_xldDistanceContoursXldDistanceContoursXldDistanceContoursXlddistance_contours_xld, get_distance_transform_xld_contourget_distance_transform_xld_contourGetDistanceTransformXldContourGetDistanceTransformXldContourGetDistanceTransformXldContourget_distance_transform_xld_contour, read_distance_transform_xldread_distance_transform_xldReadDistanceTransformXldReadDistanceTransformXldReadDistanceTransformXldread_distance_transform_xld, deserialize_distance_transform_xlddeserialize_distance_transform_xldDeserializeDistanceTransformXldDeserializeDistanceTransformXldDeserializeDistanceTransformXlddeserialize_distance_transform_xld, get_distance_transform_xld_paramget_distance_transform_xld_paramGetDistanceTransformXldParamGetDistanceTransformXldParamGetDistanceTransformXldParamget_distance_transform_xld_param, set_distance_transform_xld_paramset_distance_transform_xld_paramSetDistanceTransformXldParamSetDistanceTransformXldParamSetDistanceTransformXldParamset_distance_transform_xld_param

Module

Foundation