classPiiImageAnnotator
#include <PiiImageAnnotator.h>
An operation that draws graphics primitives on an image.
Inherits PiiDefaultOperation
Description
Supported annotations include text, points, lines, rectangles, ellipses, and circles.
Inputs
annotation is
connected.
Outputs
Properties
|
QVariantList
|
List of annotations to be always drawn. |
|
Annotation type. |
|
|
The brush used for annotations. |
|
|
bool
|
Disable/enable operation. |
|
The font used for textual annotations. |
|
|
The pen used for annotations. |
|
|
Text position. |
Public types
|
enum
|
{ Text, Point, Line, Rectangle, Ellipse, Circle, Auto }
Supported annotation types. |
Constructors and destructor
Public member functions
|
QVariantList
|
( )
|
|
( )
|
|
|
( )
|
|
|
virtual void
|
(
Checks the operation for execution. |
|
bool
|
( )
|
|
( )
|
|
|
( )
|
|
|
void
|
(
|
|
void
|
|
|
void
|
|
|
void
|
(
|
|
void
|
|
|
void
|
|
|
void
|
|
|
( )
|
Protected member functions
|
virtual void
|
( )
Executes one round of processing. |
Property details
-
QVariantList annotations
[read, write]List of annotations to be always drawn.
Each entry in this list must be a QVariantMap that stores the properties of the annotation.
-
AnnotationType annotationType
[read, write]Annotation type.
If the
typeinput is not connected, all items received from theannotationinput are assumed to be of this type. The default isAuto. -
QBrush brush
[read, write]The brush used for annotations.
-
bool enabled
[read, write]Disable/enable operation.
If operation has disabled, we will only emit the image object forward.
-
QFont font
[read, write]The font used for textual annotations.
-
QPen pen
[read, write]The pen used for annotations.
-
QPoint textPosition
[read, write]Text position.
This property has an effect only with
Texttype annotations. The string read from theannotationinput will be placed on the given coordinates. The default is (0,0).
Enumeration details
-
enum AnnotationType
Supported annotation types.
-
Text- the input is read as a QString. Primitive types will be automatically converted to strings. See textPosition. -
Point- the input is a N-by-2 matrix in which each row stores point coordinates (x,y). -
Line- the input is a N-by-4 matrix in which each row stores the start and end coordinates of the line (x1,y1,x2,y2). -
Rectangle- the input is a N-by-4 matrix in which each row stores the upper left corner coordinates, width, and height (x,y,w,h). -
Ellipse- the input is a N-by-4 matrix in which each row stores a rectangle framing the ellipse (x,y,w,h) -
Circle- the input is a N-by-3 matrix in which each row stores the center point and radius of a circle (x,y,r). -
Auto- the number of columns in the input determines the type. 2 columns is a point, 3 columns a circle, and 4 columns a rectangle.
-
Function details
-
PiiImageAnnotator
() -
~PiiImageAnnotator
() -
QVariantList annotations
() -
AnnotationType annotationType
() -
QBrush brush
() -
virtual void check
(- bool reset
[virtual]Checks the operation for execution.
This function creates a suitable flow controller by calling createFlowController(). It then sets the flow controller to the active processor and sets the processor as the input controller for all inputs.
If you change socket groupings in your overridden implementation, please call PiiDefaultOperation::check() after that. Otherwise, your new groupings will not be in effect.
Reimplemented from PiiDefaultOperation.
-
bool enabled
() -
QFont font
() -
QPen pen
() -
void setAnnotations
(- const QVariantList & annotations
-
void setAnnotationType
-
void setBrush
-
void setEnabled
(- bool enabled
-
void setFont
-
void setPen
-
void setTextPosition
-
QPoint textPosition
() -
virtual void process
()[protected, virtual]Executes one round of processing.
This function is invoked by the processor if the necessary preconditions for a new processing round are met. This function does all the necessary calculations to create output objects and sends them to output sockets.
Calls to process(), syncEvent(), and setProperty() are synchronized and cannot occur simultaneously. PiiDefaultOperation ensures this by locking processLock() for reading before calling process().
Note: With time-consuming operations, one should occasionally check that the operation hasn't been interrupted, i.e. that state() returns
Running.Exceptions
- PiiExecutionException
-
whenever an unrecoverable error occurs during a processing round, the operation is interrupted, or finishes execution due to end of input data.
Reimplemented from PiiDefaultOperation.
Add a note
Not a single note added yet. Be the first, add yours.