Operators

# polar_trans_region (Operator)

## Name

polar_trans_region — Transform a region within an annular arc to polar coordinates.

## Signature

polar_trans_region(Region : PolarTransRegion : Row, Column, AngleStart, AngleEnd, RadiusStart, RadiusEnd, Width, Height, Interpolation : )

## Description

polar_trans_region transforms a Region within the annular arc specified by the center point (Row, Column), the radii RadiusStart and RadiusEnd and the angles AngleStart and AngleEnd to its polar coordinate version in a virtual image of the dimensions Width x Height.

The polar transformation is a change of the coordinate system. Instead of a row and a column coordinate, each point's position is expressed by its radius r (i.e. the distance to the center point Row, Column) and the angle phi between the column axis (through the center point) and the line from the center point towards the point. Note that this transformation is not affine.

The coordinate (0,0) in the output region always corresponds to the point in the input region that is specified by RadiusStart and AngleStart. Analogously, the coordinate (Height-1, Width-1) corresponds to the point in the input region that is specified by RadiusEnd and AngleEnd. In the usual mode (AngleStart < AngleEnd and RadiusStart < RadiusEnd), the polar transformation is performed in the mathematically positive orientation (counterclockwise). Furthermore, points with smaller radii lie in the upper part of the output region. By suitably exchanging the values of these parameters (e.g., AngleStart > AngleEnd or RadiusStart > RadiusEnd), any desired orientation of the output region can be achieved.

The angles can be chosen from all real numbers. Center point and radii can be real as well. However, if they are both integers and the difference of RadiusEnd and RadiusStart equals Height-1, calculation will be sped up through an optimized routine.

The radii and angles are inclusive, which means that the first row of the virtual target image contains the circle with radius RadiusStart and the last row contains the circle with radius RadiusEnd. For complete circles, where the difference between AngleStart and AngleEnd equals (360 degrees), this also means that the first column of the target image will be the same as the last.

To avoid this, do not make this difference , but degrees instead.

The parameter Interpolation is used to select the interpolation method 'bilinear' or 'nearest_neighbor'. Setting Interpolation to 'bilinear' leads to smoother region boundaries, especially if regions are enlarged. However, the runtime increases significantly.

If more than one region is passed in Region, their polar transformations are computed individually and stored as a tuple in PolarTransRegion. Please note that the indices of an input region and its transformation only correspond if the system variable 'store_empty_regions' is set to 'true' (see set_system). Otherwise empty output regions are discarded and the length of the input tuple Region is most likely not equal to the length of the output tuple PolarTransRegion.

## Attention

If Width or Height are chosen greater than the dimensions of the current image, the system variable 'clip_region' should be set to 'false' (see set_system). Otherwise, an output region that does not lie within the dimensions of the current image can produce an error message.

## Parallelization

• Multithreading type: reentrant (runs in parallel with non-exclusive operators).
• Automatically parallelized on tuple level.
• Automatically parallelized on internal data level.

## Parameters

Region (input_object)  region(-array) object

Input region.

PolarTransRegion (output_object)  region(-array) object

Output region.

Row (input_control)  number (real / integer)

Row coordinate of the center of the arc.

Default value: 256

Suggested values: 0, 16, 32, 64, 128, 240, 256, 480, 512

Typical range of values: 0 ≤ Row ≤ 32767

Restriction: Row >= -131068 && Row <= 131068

Column (input_control)  number (real / integer)

Column coordinate of the center of the arc.

Default value: 256

Suggested values: 0, 16, 32, 64, 128, 256, 320, 512, 640

Typical range of values: 0 ≤ Column ≤ 32767

Restriction: Column >= -131068 && Column <= 131068

AngleStart (input_control)  number (real)

Angle of the ray to be mapped to column coordinate 0 of PolarTransRegion.

Default value: 0.0

Suggested values: 0.0, 0.78539816, 1.57079632, 3.141592654, 6.2831853, 12.566370616

Typical range of values: -6.2831853 ≤ AngleStart ≤ 6.2831853

AngleEnd (input_control)  number (real)

Angle of the ray to be mapped to column coordinate Width-1 of PolarTransRegion.

Default value: 6.2831853

Suggested values: 0.0, 0.78539816, 1.57079632, 3.141592654, 6.2831853, 12.566370616

Typical range of values: -6.2831853 ≤ AngleEnd ≤ 6.2831853

RadiusStart (input_control)  number (real / integer)

Radius of the circle to be mapped to row coordinate 0 of PolarTransRegion.

Default value: 0

Suggested values: 0, 16, 32, 64, 100, 128, 256, 512

Typical range of values: 0 ≤ RadiusStart ≤ 32767

RadiusEnd (input_control)  number (real / integer)

Radius of the circle to be mapped to row coordinate Height-1 of PolarTransRegion.

Default value: 100

Suggested values: 0, 16, 32, 64, 100, 128, 256, 512

Typical range of values: 0 ≤ RadiusEnd ≤ 32767

Width (input_control)  number (integer)

Width of the virtual output image.

Default value: 512

Suggested values: 256, 320, 512, 640, 800, 1024

Typical range of values: 2 ≤ Width ≤ 32767

Height (input_control)  number (integer)

Height of the virtual output image.

Default value: 512

Suggested values: 240, 256, 480, 512, 600, 1024

Typical range of values: 2 ≤ Height ≤ 32767

Interpolation (input_control)  string (string)

Interpolation method for the transformation.

Default value: 'nearest_neighbor'

List of values: 'bilinear', 'nearest_neighbor'