CGraphicsOutput

class ikomia.dataprocess.pydataprocess.CGraphicsOutput

Define task output containing graphics items. Consult GraphicsItem to see the list of possible graphics types. Instance can be added as output of a CWorkflowTask or derived. This kind of output is used to manage graphics items generated in a task. Ikomia software displays it as an overlay layer on top of images or videos. Graphics items can then be forwarded as input of workflow’s following tasks. Derived from CWorkflowTaskIO.

Import

from ikomia.dataprocess import CGraphicsOutput

Methods

__init__(arg1)

__init__( (object)self) -> None :

add_complex_polygon(self, outer, inners)

Add complex polygon item to this output.

add_ellipse(self, x, y, width, height)

Add ellipse or circle item to this output.

add_item(self, item)

Add graphics item to this output.

add_point(self, point)

Add point item to this output.

add_polygon(self, points)

Add polygon item to this output.

add_polyline(self, points)

Add polyline item to this output.

add_rectangle(self, x, y, width, height)

Add rectangle or square item to this output.

add_text(self, text, x, y)

Add text item to this output.

get_items(self)

Get list of graphics items.

get_image_index(self)

Get the output index on which graphics items should be associated.

set_image_index(self, index)

Set the output index on which graphics items will be displayed (in overlay layer).

set_items(self, items)

Fill input/output with the given graphics item list.

set_new_layer(self, name)

Initiate a new graphics layer for the output with the given name.

Overridden methods

clear_data(self)

Clear input/output data.

from_json(self, jsonStr)

Set input/output data from JSON formatted string.

is_data_available(self)

Check whether the input/output contains data.

load(self, path)

Load graphics output from previsouly exported file.

save(self, path)

Save graphics output data to file.

to_json(self)

Return input/output data in JSON formatted string (compact mode).

Inherited methods

copy_static_data(self, io)

Copy the static data from the given input or ouput.

get_unit_element_count(self)

Get the number of unit elements in terms of processing scheme.

Attributes

auto_save

Auto-save status

data_type

I/O data type

dim_count

Number of dimensions

description

Custom description to explain input/output type and use

displayable

Displayable status (Ikomia Studio)

name

I/O name

source_file_path

Path to the source file used as workflow input (if any)

Details

__init__((object)arg1) None
__init__( (object)self) -> None :

Default constructor

__init__( (object)self, (str)name) -> None :

Construct a CGraphicsOutput instance with the given name.

Args:

name (str): output custom name (to give insights to end user)

__init__( (object)arg1, (CGraphicsOutput)arg2) -> None :

Copy constructor

add_complex_polygon((CGraphicsOutput)self, (object)outer, (object)inners) CGraphicsItem :

Add complex polygon item to this output. A complex polygon means a polygon with one or several holes inside. Item properties (color, size…) come from the global preferences of Ikomia software. They can be adjusted interactively from the option button of the graphics toolbar.

Args:

outer (CPointF list): list of polygon vertices (x,y)

inners (list of CPointF list): list of inner polygons (holes)

add_complex_polygon( (CGraphicsOutput)self, (object)outer, (object)inners, (GraphicsPolygonProperty)properties) -> CGraphicsItem :

Add complex polygon item to this output with the given display properties (color, size…). A complex polygon means a polygon with one or several holes inside.

Args:

outer (CPointF list): list of polygon vertices (x,y)

inners (list of CPointF list): list of inner polygons (holes)

properties (GraphicsPolygonProperty): display properties

add_ellipse((CGraphicsOutput)self, (float)x, (float)y, (float)width, (float)height) CGraphicsItem :

Add ellipse or circle item to this output. Item properties (color, size…) come from the global preferences of Ikomia software. They can be adjusted interactively from the option button of the graphics toolbar.

Args:

x (float): x-coordinate of the top-left point.

y (float): y-coordinate of the top-left point.

width (float): width of the ellipse

height (float): height of the ellipse

add_ellipse( (CGraphicsOutput)self, (float)x, (float)y, (float)width, (float)height, (GraphicsEllipseProperty)properties) -> CGraphicsItem :

Add ellipse or circle item to this output with the given display properties (color, size…).

Args:

x (float): x-coordinate of the top-left point.

y (float): y-coordinate of the top-left point.

width (float): width of the ellipse

height (float): height of the ellipse

properties (GraphicsEllipseProperty): display properties

add_item((CGraphicsOutput)self, (CGraphicsItem)item) None :

Add graphics item to this output. Object class must be derived from CGraphicsItem. Use this method only if you need to add user-defined graphics items. Consult GraphicsItem to see the list of built-in graphics items.

Parameters:

item (CGraphicsItem based object)

add_point((CGraphicsOutput)self, (CPointF)point) CGraphicsItem :

Add point item to this output. Item properties (color, size…) come from the global preferences of Ikomia software. They can be adjusted interactively from the option button of the graphics toolbar.

Args:

point (CPointF): position in image coordinates

add_point( (CGraphicsOutput)self, (CPointF)point, (GraphicsPointProperty)properties) -> CGraphicsItem :

Add point item to this output with the given display properties (color, size…)

Args:

point (CPointF): position in image coordinates

properties (GraphicsPointProperty): display properties

add_polygon((CGraphicsOutput)self, (object)points) CGraphicsItem :

Add polygon item to this output. The polygon is closed automatically. Item properties (color, size…) come from the global preferences of Ikomia software. They can be adjusted interactively from the option button of the graphics toolbar.

Args:

points (CPointF list): list of polygon vertices (x,y)

add_polygon( (CGraphicsOutput)self, (object)points, (GraphicsPolygonProperty)properties) -> CGraphicsItem :

Add polygon item to this output with the given display properties (color, size…).

Args:

points (CPointF list): list of polygon vertices (x,y)

properties (GraphicsPolygonProperty): display properties

add_polyline((CGraphicsOutput)self, (object)points) CGraphicsItem :

Add polyline item to this output. Item properties (color, size…) come from the global preferences of Ikomia software. They can be adjusted interactively from the option button of the graphics toolbar.

Args:

points (CPointF list): list of polygon vertices (x,y)

add_polyline( (CGraphicsOutput)self, (object)points, (GraphicsPolylineProperty)properties) -> CGraphicsItem :

Add polyline item to this output with the given display properties (color, size…).

Args:

points (CPointF list): list of polygon vertices (x,y)

properties (GraphicsPolylineProperty): display properties

add_rectangle((CGraphicsOutput)self, (float)x, (float)y, (float)width, (float)height) CGraphicsItem :

Add rectangle or square item to this output. Item properties (color, size…) come from the global preferences of Ikomia software. They can be adjusted interactively from the option button of the graphics toolbar.

Args:

x (float): x-coordinate of the top-left point.

y (float): y-coordinate of the top-left point.

width (float): width of the rectangle

height (float): height of the rectangle

add_rectangle( (CGraphicsOutput)self, (float)x, (float)y, (float)width, (float)height, (GraphicsRectProperty)properties) -> CGraphicsItem :

Add rectangle or square item to this output with the given display properties (color, size…).

Args:

x (float): x-coordinate of the top-left point.

y (float): y-coordinate of the top-left point.

width (float): width of the rectangle

height (float): height of the rectangle

properties (GraphicsRectProperty): display properties

add_text((CGraphicsOutput)self, (str)text, (float)x, (float)y) CGraphicsItem :

Add text item to this output. Item properties (color, size…) come from the global preferences of Ikomia software. They can be adjusted interactively from the option button of the graphics toolbar.

Args:

text (str): text to display

x (float): x-coordinate of the top-left point.

y (float): y-coordinate of the top-left point.

add_text( (CGraphicsOutput)self, (str)text, (float)x, (float)y, (GraphicsTextProperty)properties) -> CGraphicsItem :

Add text item to this output with the given display properties (color, size…).

Args:

text (str): text to display

x (float): x-coordinate of the top-left point.

y (float): y-coordinate of the top-left point.

properties (GraphicsTextProperty): display properties

clear_data((CGraphicsOutput)self) None :

Clear input/output data.

clear_data( (CGraphicsOutput)self) -> None

copy_static_data((CWorkflowTaskIO)self, (CWorkflowTaskIO)io) None :

Copy the static data from the given input or ouput. Static data are those which are not generated at runtime. Should be overriden for custom input or output.

Args:

CWorkflowTaskIO: input or ouput instance from which data is copied

copy_static_data( (CWorkflowTaskIO)self, (CWorkflowTaskIO)io) -> None

from_json((CGraphicsOutput)self, (str)jsonStr) None :

Set input/output data from JSON formatted string.

Args:

str: data as JSON formatted string

from_json( (CGraphicsOutput)self, (str)jsonStr) -> None

get_items((CGraphicsOutput)self) object :

Get list of graphics items.

Returns:

list of CGraphicsItem based objects

get_image_index((CGraphicsOutput)self) int :

Get the output index on which graphics items should be associated. Index must refer to an existing output managing image data such as CImageIO or derived.

Returns:

index of image-based output

Return type:

int

get_unit_element_count((CWorkflowTaskIO)self) int :

Get the number of unit elements in terms of processing scheme. This value is used to define the number of progress steps for progress bar component in Ikomia STUDIO. For an image, the count is 1. For Z-stack volume, the count is the number of Z levels. Should be overriden for custom input or output.

Returns:

int: number of unit element to process

get_unit_element_count( (CWorkflowTaskIO)self) -> int

is_data_available((CGraphicsOutput)self) bool :

Check whether the input/output contains data.

Returns:

bool: True if input contains data, False otherwise

is_data_available( (CGraphicsOutput)self) -> bool

load((CGraphicsOutput)self, (str)path) None :

Load graphics output from previsouly exported file. The file must be in JSON format.

Args:

path (str)

load( (CGraphicsOutput)self, (str)path) -> None

save((CGraphicsOutput)self, (str)path) None :

Save graphics output data to file. The file must be in JSON format.

Args:

path (str)

save( (CGraphicsOutput)self, (str)path) -> None

set_items((CGraphicsOutput)self, (object)items) None :

Fill input/output with the given graphics item list.

Parameters:

items (list of CGraphicsItem) – based objects

set_image_index((CGraphicsOutput)self, (int)index) None :

Set the output index on which graphics items will be displayed (in overlay layer). Index must refer to an existing output managing image data such as CImageIO or derived.

Parameters:

index (int) – index of image-based output

set_new_layer((CGraphicsOutput)self, (str)name) None :

Initiate a new graphics layer for the output with the given name. The method clears all graphics items that was previously generated.

Parameters:

name (str) – name of the associated graphics layer

to_json((CGraphicsOutput)self) str :

Return input/output data in JSON formatted string (compact mode).

Returns:

string: JSON formatted string

to_json( (CGraphicsOutput)self) -> str

to_json( (CGraphicsOutput)self, (object)options) -> str :

Return input/output data in JSON formatted string. JSON format option can be set, possible values are:

  • [‘json_format’, ‘compact’] (default)

  • [‘json_format’, ‘indented’]

Args:

list of str: format-specific options encoded as pairs [option_name, option_value]

Returns:

string: JSON formatted string

to_json( (CGraphicsOutput)self, (object)options) -> str