shape_trans shape_trans ShapeTrans ShapeTrans shape_trans (Operator)
Name
shape_trans shape_trans ShapeTrans ShapeTrans shape_trans
— Transform the shape of a region.
Signature
def shape_trans (region : HObject, type : str) -> HObject
Description
shape_trans shape_trans ShapeTrans ShapeTrans ShapeTrans shape_trans
transforms the shape of the input regions
depending on the parameter Type Type Type Type type type
:
'convex'
Convex hull.
'ellipse'
Ellipse with the same moments and area as the input region.
'outer_circle'
Smallest enclosing circle.
'inner_circle'
Largest circle fitting into the region.
'rectangle1'
Smallest enclosing rectangle parallel to the coordinate axes.
'rectangle2'
Smallest enclosing rectangle.
'inner_rectangle1'
Largest axis-parallel rectangle fitting into the region.
'inner_center'
The point on the skeleton of the input region having the smallest
distance to the center of gravity of the input region.
Attention
If Type Type Type Type type type
= 'outer_circle' "outer_circle" "outer_circle" "outer_circle" "outer_circle" "outer_circle" is selected it might
happen that the resulting circular region does not completely cover
the input region. This is because internally the operators
smallest_circle smallest_circle SmallestCircle SmallestCircle SmallestCircle smallest_circle
and gen_circle gen_circle GenCircle GenCircle GenCircle gen_circle
are used to compute
the outer circle. As described in the documentation of
smallest_circle smallest_circle SmallestCircle SmallestCircle SmallestCircle smallest_circle
, the calculated radius can be too small by
up to
pixels. Additionally, the
circle that is generated by gen_circle gen_circle GenCircle GenCircle GenCircle gen_circle
is translated by up
to 0.5 pixels in both directions, i.e., by up to
pixels. Consequently, when adding up
both effects, the original region might protrude beyond the returned
circular region by at most 1 pixel.
Execution Information
Multithreading type: reentrant (runs in parallel with non-exclusive operators).
Multithreading scope: global (may be called from any thread).
Automatically parallelized on tuple level.
Parameters
Region Region Region Region region region
(input_object) region(-array) →
object HRegion HObject HRegion Hobject
Regions to be transformed.
RegionTrans RegionTrans RegionTrans RegionTrans regionTrans region_trans
(output_object) region(-array) →
object HRegion HObject HRegion Hobject *
Transformed regions.
Type Type Type Type type type
(input_control) string →
HTuple str HTuple Htuple (string) (string ) (HString ) (char* )
Type of transformation.
Default value:
'convex'
"convex"
"convex"
"convex"
"convex"
"convex"
List of values: 'convex' "convex" "convex" "convex" "convex" "convex" , 'ellipse' "ellipse" "ellipse" "ellipse" "ellipse" "ellipse" , 'inner_center' "inner_center" "inner_center" "inner_center" "inner_center" "inner_center" , 'inner_circle' "inner_circle" "inner_circle" "inner_circle" "inner_circle" "inner_circle" , 'inner_rectangle1' "inner_rectangle1" "inner_rectangle1" "inner_rectangle1" "inner_rectangle1" "inner_rectangle1" , 'outer_circle' "outer_circle" "outer_circle" "outer_circle" "outer_circle" "outer_circle" , 'rectangle1' "rectangle1" "rectangle1" "rectangle1" "rectangle1" "rectangle1" , 'rectangle2' "rectangle2" "rectangle2" "rectangle2" "rectangle2" "rectangle2"
Complexity
Let F be the area of the input region. Then the runtime
complexity is O(F).
Result
shape_trans shape_trans ShapeTrans ShapeTrans ShapeTrans shape_trans
returns 2 (H_MSG_TRUE) if all parameters are correct.
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>) SetSystem("no_object_result",<Result>) set_system("no_object_result",<Result>)
.
If necessary, an exception is raised.
Possible Predecessors
connection connection Connection Connection Connection connection
,
regiongrowing regiongrowing Regiongrowing Regiongrowing Regiongrowing regiongrowing
Possible Successors
disp_region disp_region DispRegion DispRegion DispRegion disp_region
,
regiongrowing_mean regiongrowing_mean RegiongrowingMean RegiongrowingMean RegiongrowingMean regiongrowing_mean
,
area_center area_center AreaCenter AreaCenter AreaCenter area_center
See also
convexity convexity Convexity Convexity Convexity convexity
,
elliptic_axis elliptic_axis EllipticAxis EllipticAxis EllipticAxis elliptic_axis
,
area_center area_center AreaCenter AreaCenter AreaCenter area_center
,
smallest_rectangle1 smallest_rectangle1 SmallestRectangle1 SmallestRectangle1 SmallestRectangle1 smallest_rectangle1
,
smallest_rectangle2 smallest_rectangle2 SmallestRectangle2 SmallestRectangle2 SmallestRectangle2 smallest_rectangle2
,
inner_rectangle1 inner_rectangle1 InnerRectangle1 InnerRectangle1 InnerRectangle1 inner_rectangle1
,
set_shape set_shape SetShape SetShape SetShape set_shape
,
select_shape select_shape SelectShape SelectShape SelectShape select_shape
,
inner_circle inner_circle InnerCircle InnerCircle InnerCircle inner_circle
Module
Foundation