ClassesClasses | | Operators

sort_regionsort_regionSortRegionSortRegion (Operator)

Name

sort_regionsort_regionSortRegionSortRegion — Sorting of regions with respect to their relative position.

Signature

sort_region(Regions : SortedRegions : SortMode, Order, RowOrCol : )

Herror sort_region(const Hobject Regions, Hobject* SortedRegions, const char* SortMode, const char* Order, const char* RowOrCol)

Herror T_sort_region(const Hobject Regions, Hobject* SortedRegions, const Htuple SortMode, const Htuple Order, const Htuple RowOrCol)

void SortRegion(const HObject& Regions, HObject* SortedRegions, const HTuple& SortMode, const HTuple& Order, const HTuple& RowOrCol)

HRegion HRegion::SortRegion(const HString& SortMode, const HString& Order, const HString& RowOrCol) const

HRegion HRegion::SortRegion(const char* SortMode, const char* Order, const char* RowOrCol) const

static void HOperatorSet.SortRegion(HObject regions, out HObject sortedRegions, HTuple sortMode, HTuple order, HTuple rowOrCol)

HRegion HRegion.SortRegion(string sortMode, string order, string rowOrCol)

Description

The operator sort_regionsort_regionSortRegionSortRegionSortRegion sorts the regions with respect to their relative position. All sorting methods with the exception of 'character'"character""character""character""character" use one point of the region. With the help of the parameter RowOrColRowOrColRowOrColRowOrColrowOrCol = 'row'"row""row""row""row" these points will be sorted according to their row and then according to their column. By using 'column'"column""column""column""column", the column value will be used first. The following values are available for the parameter SortModeSortModeSortModeSortModesortMode:

'character'"character""character""character""character"

The regions will be treated like characters in a row and will be sorted according to their order in the line: If two regions overlap horizontally, they will be sorted with respect to their column values, otherwise they will be sorted with regard to their row values. To be able to sort a line correctly, all regions in the line must overlap each other vertically. Furthermore, the regions in adjacent rows must not overlap.

'first_point'"first_point""first_point""first_point""first_point"

The point with the lowest column value in the first row of the region.

'last_point'"last_point""last_point""last_point""last_point"

The point with the highest column value in the last row of the region.

'upper_left'"upper_left""upper_left""upper_left""upper_left"

Upper left corner of the surrounding rectangle.

'upper_right'"upper_right""upper_right""upper_right""upper_right"

Upper right corner of the surrounding rectangle.

'lower_left'"lower_left""lower_left""lower_left""lower_left"

Lower left corner of the surrounding rectangle.

'lower_right'"lower_right""lower_right""lower_right""lower_right"

Lower right corner of the surrounding rectangle.

The parameter OrderOrderOrderOrderorder determines whether the sorting order is increasing or decreasing: using 'true'"true""true""true""true" the order will be increasing, using 'false'"false""false""false""false" the order will be decreasing.

Execution Information

Parameters

RegionsRegionsRegionsRegionsregions (input_object)  region-array objectHRegionHRegionHobject

Regions to be sorted.

SortedRegionsSortedRegionsSortedRegionsSortedRegionssortedRegions (output_object)  region-array objectHRegionHRegionHobject *

Sorted regions.

SortModeSortModeSortModeSortModesortMode (input_control)  string HTupleHTupleHtuple (string) (string) (HString) (char*)

Kind of sorting.

Default value: 'first_point' "first_point" "first_point" "first_point" "first_point"

List of values: 'character'"character""character""character""character", 'first_point'"first_point""first_point""first_point""first_point", 'last_point'"last_point""last_point""last_point""last_point", 'lower_left'"lower_left""lower_left""lower_left""lower_left", 'lower_right'"lower_right""lower_right""lower_right""lower_right", 'upper_left'"upper_left""upper_left""upper_left""upper_left", 'upper_right'"upper_right""upper_right""upper_right""upper_right"

OrderOrderOrderOrderorder (input_control)  string HTupleHTupleHtuple (string) (string) (HString) (char*)

Increasing or decreasing sorting order.

Default value: 'true' "true" "true" "true" "true"

List of values: 'false'"false""false""false""false", 'true'"true""true""true""true"

RowOrColRowOrColRowOrColRowOrColrowOrCol (input_control)  string HTupleHTupleHtuple (string) (string) (HString) (char*)

Sorting first with respect to row, then to column.

Default value: 'row' "row" "row" "row" "row"

List of values: 'column'"column""column""column""column", 'row'"row""row""row""row"

Result

If the parameters are correct, the operator sort_regionsort_regionSortRegionSortRegionSortRegion returns the value 2 (H_MSG_TRUE). Otherwise an exception will be raised.

Possible Successors

do_ocr_multi_class_mlpdo_ocr_multi_class_mlpDoOcrMultiClassMlpDoOcrMultiClassMlpDoOcrMultiClassMlp, do_ocr_single_class_mlpdo_ocr_single_class_mlpDoOcrSingleClassMlpDoOcrSingleClassMlpDoOcrSingleClassMlp

Module

Foundation


ClassesClasses | | Operators