RegionAnnotation module

class lys.widgets.canvas.interface.RegionAnnotation.FreeRegionAnnotation(canvas, region, width, axis)[source]

Bases: AnnotationWithLine

Interface to access free region annotations in canvas.

FreeRegionAnnotation is usually generated by addFreeRegionAnnotation method in canvas.

Several methods related to the appearance of line is inherited from AnnotationData.AnnotationWithLine

Parameters
  • canvas (Canvas) – canvas to which the line annotation is added.

  • region (2*2 sequence) – The position of the region in the form of [(x0, y0), (x1 ,y1)]

  • width (float) – The width of the region.

  • axis ('BottomLeft', 'BottomRight', 'TopLeft', or 'TopRight') – The axis to which the annotation is added.

Example:

from lys import display
g = display()
rect = g.canvas.addFreeRegionAnnotation()
rect.setLineColor("#ff0000")
getRegion()[source]

Get the region of the annotation.

Returns

The position of the region in the form of [(x0, y0), (x1 ,y1)]

Return type

2*2 sequence

getWidth()[source]

Get the width of the annotation.

Returns

The width of annotation.

Return type

float

regionChanged

PyqtSignal that is emitted when the region is changed.

setRegion(region)[source]

Set region of the annotation.

Parameters

region (2*2 sequence) – The position of the region in the form of [(x0, y0), (x1 ,y1)]

setWidth(width)[source]

Set width of the annotation.

Parameters

width (float) – The width of annotation.

widthChanged

PyqtSignal that is emitted when the region width is changed.

class lys.widgets.canvas.interface.RegionAnnotation.RegionAnnotation(canvas, region, orientation, axis)[source]

Bases: AnnotationWithLine

Interface to access region annotations in canvas.

RegionAnnotation is usually generated by addRegionAnnotation method in canvas.

Several methods related to the appearance of line is inherited from AnnotationData.AnnotationWithLine

Parameters
  • canvas (Canvas) – canvas to which the line annotation is added.

  • region (length 2 sequence) – The region of the annotation in the form of (x1, x2).

  • axis ('BottomLeft', 'BottomRight', 'TopLeft', or 'TopRight') – The axis to which the line annotation is added.

Example:

from lys import display
g = display()
rect = g.canvas.addRegionAnnotation()
rect.setLineColor("#ff0000")
getOrientation()[source]

Get the orientation of the annotation.

Returns

The orientation of annotation (‘vertical’ or ‘horizontal’)

Return type

str

getRegion()[source]

Get the region of the annotation.

Returns

The region of annotation in the form of (x1, x2)

Return type

length 2 sequence

regionChanged

PyqtSignal that is emitted when the region is changed.

setRegion(region)[source]

Set region of the annotation.

Parameters

region (length 2 sequence) – The region of rectangle in the form of (x1, x2)