8.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 itom, that 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 pointCloud) 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 ui and uiItem).

The full script reference of the module itom can be found in the help of itom.

8.1.1. Import 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 itom:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
#1. import the whole module. Any method is then directly accessible
from itom import *
filterHelp("...")

#2. import the itom module without the global access to its methods
import itom
itom.filterHelp("...")

#3. only import certain methods or classes of the module itom
from itom import filterHelp as anyAlias
anyAlias("...")

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.

8.1.1.1. Content of itom

  • class 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.

  • classes ui and uiItem are 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 advanced dialogs and windows or their definitions in the script reference ui and uiItem.

  • classes pointCloud and itom.polygonMesh are wrapper for point clouds and polygon mesh structures that are given by the optional integrated Point Cloud Library.

  • class dataIO is 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.

  • class timer is 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. itom also 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 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.

See the itom script reference for a full reference to all classes and methods provided by the module itom.