OpenCMISS Exporter

OpenCMISS Exporter is a Python package for exporting Argon documents to different formats. The exporter can export an Argon document to the following formats:

  • webGL

  • Thumbnail

webGL

The webGL export takes scenes described in an Argon document and produces a JSON description of the scenes. The JSON description is exported to a format @abi-software/scaffoldvuer can read and create a visualisation in the browser.

Usage:

from opencmiss.exporter import webgl

argon_document = "argon-document.json"
output_directory = "."

exporter = webgl.ArgonSceneExporter(output_target=output_directory)
exporter.load(argon_document)
exporter.export()

Thumbnail

The thumbnail export takes scenes described in an Argon document and produces a JPEG thumbnail for each of the scenes. The thumbnail export does not currently support time varying scenes. If an Argon document describes a time varying scene then only one thumbnail will be created and that will be done at the default time.

Usage:

from opencmiss.exporter import thumbnail

argon_document = "argon-document.json"
output_directory = "."

exporter = thumbnail.ArgonSceneExporter(output_target=output_directory)
exporter.load(argon_document)
exporter.export()

Package API

webGL Module

Export an Argon document to WebGL documents suitable for scaffoldvuer.

class opencmiss.exporter.webgl.ArgonSceneExporter(output_target=None, output_prefix=None)

Export a visualisation described by an Argon document to webGL.

export(output_target=None)

Export the current document to output_target. If no output_target is given then the output_target set at initialisation is used.

If there is no current document then one will be loaded from the current filename.

Parameters

output_target – Output directory location.

export_view()

Export sceneviewer parameters to JSON format

export_webgl()

Export graphics into JSON format, one json export represents one surface graphics.

Thumbnail Module

Export an Argon document to a JPEG file of size 512x512.

class opencmiss.exporter.thumbnail.ArgonSceneExporter(output_target=None, output_prefix=None)

Export a visualisation described by an Argon document to JPEG thumbnail. By default the export will be use PySide2 to render the scene. An alternative is to use OSMesa for software rendering. To use OSMesa as the renderer either set the environment variable OC_EXPORTER_RENDERER to ‘osmesa’ or not have PySide2 available in the calling environment.

export(output_target=None)

Export the current document to output_target. If no output_target is given then the output_target set at initialisation is used.

If there is no current document then one will be loaded from the current filename.

Parameters

output_target – Output directory location.

export_thumbnail()

Export graphics into an image format.

Base Module

class opencmiss.exporter.base.BaseExporter(output_prefix)
load(filename)

Loads the named Argon file and on success sets filename as the current location. Emits documentChange separately if new document loaded, including if existing document cleared due to load failure.

Returns

True on success, otherwise False.

set_document(document)

Set the document to export.

Parameters

document – Set the document to export.

set_filename(filename)

Set filename.

Parameters

filename – The filename for the Argon document.

set_parameters(parameters)

Set the parameters for this exporter. The parameters must have values for:

  • numberOfTimeSteps

  • initialTime

  • finishTime

  • prefix

Parameters

parameters – A dict of parameters.