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

HRegion HRegion::SortRegion(const wchar_t* SortMode, const wchar_t* Order, const wchar_t* RowOrCol) const   (Windows only)

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 are treated like characters, which can be read horizontally or vertically. They are sorted according to the reading direction given by RowOrColRowOrColRowOrColRowOrColrowOrCol with the following specifications:

Note that in case OrderOrderOrderOrderorder is set to 'false'"false""false""false""false", the characters are sorted in a reversed order to the one described above.

'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