9.1. Python-Module itom¶
The main purpose of the embedded Python interpreter in itom is to access the specific functionalities provided by itom. This is done by the Python-module
is importable only in the embedded Python interpreter in itom. This module includes interfaces for hardware and algorithm plugins of itom (see here for more information) as well as classes that wrap the
most important internal data structures of itom, like matrices (class
dataObject, link to documentation), point clouds (class
or polygon meshes (class
polygonMesh). Additionally the module provides functions to manipulate or extend the graphical user interface of itom as well as to
create own dialogs or windows (provided by the class
The full script reference of the module
itom can be found in the help of itom.
Like any other python module, you need to import the module
itom in your script. Usually, the import is done at the beginning of a script. In the following example, it
is shown how the method filterHelp of the module
itom can be called with respect to different ways of import
1#1. import the whole module. Any method is then directly accessible 2from itom import * 3filterHelp("...") 4 5#2. import the itom module without the global access to its methods 6import itom 7itom.filterHelp("...") 8 9#3. only import certain methods or classes of the module itom 10from itom import filterHelp as anyAlias 11anyAlias("...")
If you simply type any commands in the itom command line or if you directly execute
any script at the top level, you don’t need import the module
itom, since this module
already has been imported at startup of itom with
from itom import *
However, if you import another script file in your main script file and you want to access any methods of
itom in this secondary script,
then you need to import
itom in this script using one of the methods shown above.
dataObject. This is the itom internal matrix class, compatible to
numpy.array, and also used by any connected grabber or camera. Every matrix is extended by fixed and user-defined tags and keywords. For an introduction to the data object, see Array class DataObject, a full reference is available under
dataObject. The data object is compatible to any numpy array, however the tags and keywords will get lost.
uiItemare the main classes for creating user defined dialogs and windows in itom and show them using some lines of script code. For more information about their use, see Creating customized dialogs, windows and dock widgets or their definitions in the script reference
dataIOis the class in order to access any plugin instance of type dataIO (cameras, grabbers, AD-converter…). The full reference can be found under
dataIO. More information about cameras and other dataIO devices can be found under Getting started with grabbers and Getting started with A/D converters.
timeris the class to create a timer object that continuously calls a piece of Python code or a method with an adjustable interval.
class actuator is the class in order to access any plugin instance of type actuator, like motor stages… The full reference can be found under
actuator. More information about actuator devices can be found under Getting started with actuators.
- other class free methods.
itomalso directly contains a lot of methods, that makes features of itom accessible by a Python script. By these methods you can
add or remove buttons or items to the itom menu and toolbar (see Customize the menu bar and toolbars of itom)
get help about plugins and their functionality
call any algorithm or filter, provided by a plugin of type algo
directly plot matrices like dataObjects.
- other class free methods.