DataDictIO#
- class ikomia.dataprocess.datadictIO.DataDictIO#
Class implementing Ikomia workflow input/output object where data is stored as generic Python dict. Please note that such unformatted data are meant to be used as task output essentially. For complete compatibility with other API features, you must ensure that the dict content is fully JSON serializable. Inherit
CWorkflowTaskIO
.- Variables:
data – data dictionary
Import
from ikomia.dataprocess.datadictIO import DataDictIO
Overridden methods
Clear whole data dict.
Check whether the dataset structure contains data.
load
(path)Load JSON as data dict I/O.
save
(path)Save data dict as JSON.
to_json
(self)Return input/output data in JSON formatted string with default options.
from_json
(self, jsonStr)Set input/output data from JSON formatted string.
Details
- __init__((object)arg1) None #
- __init__( (object)self) -> None :
Default constructor
- __init__( (object)self, (IODataType)data_type) -> None :
Constructor with parameters
Args:
data_type (
IODataType
): data type identifier- __init__( (object)self, (IODataType)data_type, (str)name) -> None :
Constructor with parameters
Args:
data_type(
IODataType
): data type identifiername (str): custom name associated to input/output to give more insights to end user
- __init__( (object)arg1, (CWorkflowTaskIO)arg2) -> None :
Copy constructor
- clear_data()#
Clear whole data dict.
- from_json((CWorkflowTaskIO)self, (str)jsonStr) None : #
Set input/output data from JSON formatted string. This method must be overriden.
Args:
jsonStr (str): data as JSON formatted string
from_json( (CWorkflowTaskIO)self, (str)jsonStr) -> None
- is_data_available()#
Check whether the dataset structure contains data.
- Returns:
True or False
- Return type:
boolean
- load(path)#
Load JSON as data dict I/O.
- Parameters:
path – file path where dataset is saved
- save(path)#
Save data dict as JSON.
- Parameters:
path – file path where data is saved
- to_json((CWorkflowTaskIO)self) str : #
Return input/output data in JSON formatted string with default options. This method must be overriden.
Returns:
str: JSON formatted string
to_json( (CWorkflowTaskIO)self) -> str
- to_json( (CWorkflowTaskIO)self, (object)options) -> str :
Return input/output data in JSON formatted string. This method must be overriden. Options available depend on input/output type, a single option is available for all to set the JSON format:
[‘json_format’, ‘compact’] (default)
[‘json_format’, ‘indented’]
Args:
options (list of str): format-specific options encoded as pairs [option_name, option_value]
Returns:
str: JSON formatted string
to_json( (CWorkflowTaskIO)self, (object)options) -> str