Python API
jipipe
jipipe.data_slot
This file provides functions that are used to manage the contents of a data slot
Zoltán Cseresnyés, Ruman Gerst
Research Group Applied Systems Biology - Head: Prof. Dr. Marc Thilo Figge https://www.leibniz-hki.de/en/applied-systems-biology.html HKI-Center for Systems Biology of Infection Leibniz Institute for Natural Product Research and Infection Biology - Hans Knöll Institute (HKI) Adolf-Reichwein-Straße 23, 07745 Jena, Germany
The project code is licensed under BSD 2-Clause. See the LICENSE file provided with the code for the full license.
DataSlot Objects
class DataSlot()
Models a JIPipe data slot.
__init__
| __init__(data_type: str, storage_path: Path, node_id="", internal_path: Path = "", name: str = "", slot_type: str = "")
Initializes a new data slot
Arguments:
data_type
: the JIPipe data type ID that is accepted in this slot. The most basic type is ‘jipipe:data’slot_type
: the type of the slot. Allowed values are ‘input’ and ‘output’. Can be empty.storage_path
: a directory where the slot data is stored. If it does not exist, one will be creatednode_id
: Metadata that indicates the node associated to this slot. Can be empty.internal_path
: Metadata that indicates the placement of this data within a hierarchy of data. Can be empty.name
: Name of the slot. Can be empty.
get_row_storage_path
| get_row_storage_path(row: int)
Returns the storage path for the provided row
Arguments:
row
: the row index
Returns:
the storage path for the row
copy_row
| copy_row(source_data_slot, source_row: int)
Copies data from the source slot into this slot
Arguments:
source_data_slot
: the source slotsource_row
: the source row
add_row
| add_row(n: int = 1, annotations: dict = None, true_data_type: str = None)
Adds n rows into the slot
Arguments:
true_data_type
: the true data type ID of this entry. If none, the slot data type is usedannotations
: annotations to set for these rowsn
: how many rows to add
Returns:
the last row index
to_table
| to_table()
Converts the data slot into a Pandas table.The format is equivalent to data-table.csv generated by JIPipe.
Returns:
Pandas table
to_dict
| to_dict()
Converts the data slot into a dict that can be serialized into JSON
Returns:
a dictionary that describes this slot
save
| save(with_csv=False)
Saves all metadata related to this slot in the storage folder. This will overwrite data-table.json and data-table.csv (if enabled)
Arguments:
with_csv
: Also write the table as CSV. The format is equivalent to the one generated by JIPipe. Writing with CSV requires pandas to be installed.
Returns:
None
import_from_folder
import_from_folder(storage_path: Path)
Imports a data slot from a storage path. A valid storage path contains ‘data-table.json’ and multiple numeric folders.
Arguments:
storage_path
: the storage path
Returns:
a DataSlot instance
jipipe.imagej
This file provides functions to read/write ImageJ data types
Zoltán Cseresnyés, Ruman Gerst
Research Group Applied Systems Biology - Head: Prof. Dr. Marc Thilo Figge https://www.leibniz-hki.de/en/applied-systems-biology.html HKI-Center for Systems Biology of Infection Leibniz Institute for Natural Product Research and Infection Biology - Hans Knöll Institute (HKI) Adolf-Reichwein-Straße 23, 07745 Jena, Germany
The project code is licensed under BSD 2-Clause. See the LICENSE file provided with the code for the full license.
get_image_file
get_image_file(data_slot: DataSlot, row: int)
Finds the image file located in imagej-imgplus-* data slot rows
Arguments:
data_slot
: the data slotrow
: the row
Returns:
path to the image file or None if not found
get_table_file
get_table_file(data_slot: DataSlot, row: int)
Finds the CSV table file located in imagej-results-table (and related) data slow rows
Arguments:
data_slot
: the data slotrow
: the row
Returns:
path to the CSV file or None if not found
load_image_file
load_image_file(data_slot: DataSlot, row: int)
Finds and loads the image file located in imagej-imgplus-* data slot rows and loads it with Skimage. Requires that Skimage is installed.
Arguments:
data_slot
: the data slotrow
: the row
Returns:
Image data or None if no image was found
load_table_file
load_table_file(data_slot: DataSlot, row: int)
Finds and loads the CSV table file in imagej-results-table (and related) data slow rows as pandas data frame Requires that pandas is installed.
Arguments:
data_slot
: the data slotrow
: the row
Returns:
Image data or None if no image was found
add_table
add_table(table, data_slot: DataSlot, annotations: dict = None)
Adds a new table into a new row of the specified slot
Arguments:
table
: the table. must be a Pandas table or dictionary that can be converted into a data framedata_slot
: the data slotannotations
: optional annotations (a dict of string keys and string values)
Returns:
index of the newly added row
add_image
add_image(image, data_slot: DataSlot, annotations: dict = None)
Adds a new image into a new row of the specified slot. The image will be saved as TIFF. Requires Skimage.
Arguments:
image
: an image. must be a numpy arraydata_slot
: the data slotannotations
: optional annotations (a dict of string keys and string values)
Returns:
index of the newly added row