Documentation – Current v25.1

Imatest IT Instructions

 

Current Documentation

All documentation versions

Introduction

Interface Type:

Watch on YouTube.

Imatest IT (Industrial Testing) is a set of Application Programming Interfaces (APIs) that allow developers to access Imatest’s powerful image quality analysis tools in their own custom applications.

Imatest IT is available for 64-bit Windows, MacOS and Linux, and includes libraries for use with C, C++, Python, Objective-C, .NET (Windows only – including C# and Visual Basic), and LabVIEW. IT also contains standalone executables that can be called from a command line or script. The API libraries perform the exact same calculations as the corresponding GUI-based Imatest Master modules.

Imatest IT is a complete package that includes the module libraries, support documentation, sample code, and complete applications that interface with the modules.

Although Imatest IT operates independently of Imatest Master, we strongly recommend that IT users have at least one Master installation on site. Imatest Ultimate Edition, which includes both IT and Image Master Edition at a significant discount, is the ideal option for most users. As you will see in Step 2 below, setting up your test configuration, an integral part of any IT application, is much easier using Master.

 

Imatest IT Modules

Imatest IT contains twenty image analysis modules:

SFR – measures MTF and related results from manually-specified slanted edges SFRplus – measures MTF, lateral chromatic aberration, distortion, tonal response, and much more using Imatest’s highly-automated SFRplus chart and module
Star – measures MTF and lateral chromatic aberration from a Siemens star chart (usually sinusoidal) Colorcheck – measures color accuracy, noise, tonal response, and more from a 24-patch X-Rite Colorchecker
Stepchart – measures tonal response, gamma, noise, and more from a grayscale stepchart Wedge – measures MTF using hyperbolic wedges, found in the ISO 12233:2000 and eSFR ISO chart
OIS – measures the efficacy of image stabilization Uniformity – measures image uniformity, color shading, and hot/dead pixels from a flat field image
Distortion – measures distortion using a grid or checkerboard pattern eSFR ISO – measures MTF, color accuracy, noise, and tonal response using an enhanced ISO 12233:2014 chart
Blemish – measures visually-significant blemishes from a flat field image Dot Pattern – measures distortion and lateral chromatic aberration from a dot grid pattern (I3A CPIQ-compliant)
Multitest – analyzes images of a large variety of test charts for color accuracy, tonal response, noise, SNR (Signal-to-Noise Ratio) and ISO sensitivity Checkerboard – measures MTF, lateral chromatic aberration, and distortion using a checkerboard target
Random – Module that measures texture quality using the spilled coins or random (spatially-invariant) chart SFRreg – measures MTF and lateral chromatic aberration using one or more automatically-detected SFRreg targets
Log FC – measures the effects of signal processing (MTF as a function of spatial frequency and contrast) using a Log Frequency-Contrast chart Arbitrary Charts – measure a wide array of image quality factors from a chart design unsupported elsewhere in Imatest (including your own custom design).
Stray Light – analyzes images of a small, bright light source that is swept through the field of view to produce normalized metric stray light images and related outputs. Concentric Rings – measures field of view from an ISO 8600-3 chart.
 

Using Imatest IT

As illustrated in this graphic, working with Imatest IT is a four-step process. Each of these steps is outlined in detail in this article.

Step 1: Prepare Test Environment and Capture Test Targets

Inputs: None
Outputs: Test Image(s)
Imatest’s analysis modules require correctly framed and properly lit images of test targets. Once your test environment is properly set up, capture images of the required test targets for the modules you will be using.

Step 2: Configure INI File w/ Test Image(s)

Inputs: Test Image(s)
Outputs: INI File(s)
Using a sampling of the test images captured in Step 1, use Imatest Master to analyze the image files, choosing the options required for your application, and setting the Regions of Interest (ROIs) for your charts. Once everything is ready, export the INI file and keep it with your application source files.

In Imatest you can use the  Save ini file for  button in the Imatest IT settings window to save an ini file with only the needed sections.

Step 3: Integrate and Call Imatest IT Modules

Inputs: Test Image(s), INI File(s)
Outputs: Analysis Results
Code your application using your preferred programming language and call the module functions with your images and INI file.

Step 4: Process the Results

Inputs: Analysis Results
Outputs: Whatever you need
Load the analysis results and use them however you wish.

 

Installing Imatest IT

If you have not already downloaded Imatest IT, you can do so on the download page.

Next, follow the installation instructions found here.

After Imatest IT has successfully installed, you will need to activate it on your computer. Follow these instructions to activate your node-locked or floating license. If the computer running Imatest IT does not have an internet connection, you can also choose to activate it offline.

Post Installation Tasks

Linux Only – Updating the LD_LIBRARY_PATH

On Linux computers, several paths need to be appended to the LD_LIBRARY_PATH environment variable. To do this, you will need to edit your ~/.bashrc (or similar) file, and include these lines

export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/usr/local/Imatest/v25.1/IT/bin
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/usr/local/Imatest/v25.1/IT/libs/library/cpp
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/usr/local/MATLAB/MATLAB_Runtime/R2024bruntime/glnxa64
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/usr/local/MATLAB/MATLAB_Runtime/R2024b/bin/glnxa64
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/usr/local/MATLAB/MATLAB_Runtime/R2024b/sys/os/glnxa64
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/usr/local/MATLAB/MATLAB_Runtime/R2024b/sys/opengl/lib/glnxa64

For more information on editing environment variables, see this article.

macOS Only – Updating DYLD_LIBRARY_PATH

On macOS computers, several paths need to be appended to the DYLD_LIBRARY_PATH environment variable by adding these lines to ~/.bash_profile:

export DYLD_LIBRARY_PATH=${DYLD_LIBRARY_PATH}:/Applications/Imatest/IT/v25.1/bin
export DYLD_LIBRARY_PATH=${DYLD_LIBRARY_PATH}:/Applications/Imatest/IT/v25.1/libs/library/cpp
export DYLD_LIBRARY_PATH=${DYLD_LIBRARY_PATH}:/Applications/MATLAB/MATLAB_Runtime/R2024b/runtime/maci64
export DYLD_LIBRARY_PATH=${DYLD_LIBRARY_PATH}:/Applications/MATLAB/MATLAB_Runtime/R2024b/bin/maci64

(Optional) – Reducing Startup Time w/ the MCR Cache

The first time you use the Imatest IT libraries, they must be unpacked to a temporary directory. This can take several seconds, depending on your system. In some use cases, this can happen on every use, especially if you are using the Imatest IT Acquisition Library.

To prevent the repeated unpacking of the IT libraries, you need to set two more environment variables: MCR_CACHE_ROOT and MCR_CACHE_SIZE. The MCR_CACHE_ROOT variable tells the Matlab Runtime where to extract the Imatest IT libraries. Setting it to a specific location that has write access for all users ensures that this cache will not be deleted by the operating system when it cleans up temporary files. The MCR_CACHE_SIZE variable is the size, in bytes, that the Matlab Runtime cache is allowed to grow to before other libraries are deleted. To keep Imatest IT running at top performance, it should be set to at least 900000000, and will result in much faster startup times for Imatest IT for some users.

Follow the instructions here to add these variables to your environment.
Windows

Variable Name Value
MCR_CACHE_ROOT C:\ProgramData\Imatest\mcr_cache\25.1\IT
MCR_CACHE_SIZE 900000000

Linux

Variable Name Value
MCR_CACHE_ROOT /var/lib/imatest/mcr_cache/25.1/IT
MCR_CACHE_SIZE 900000000

macOS

Variable Name Value
MCR_CACHE_ROOT $HOME/imatest/mcr_cache/25.1/IT
MCR_CACHE_SIZE 900000000

Note that for macOS you will need to create this folder.

Other Additional Installation Steps

Select your preferred interface below to see detailed instructions.

Interface Type:

The Imatest IT Python Interface is shipped as a Python module. Before referencing it in your scripts, you will need to install it using Python’s package manager. This must be done on the command line, and requires Administrator access. If you don’t know how to open a Command Prompt with Administrator privileges in Windows, see this helpful article.

Note: Imatest IT only supports Python versions 3.9, 3.10, 3.11 and 3.12(see IT/Python Supported Python Versions).

First, navigate to the Imatest IT Python library directory.

Windows

cd C:\Program Files\Imatest\v25.1\IT\libs\library\python\

Linux

cd /usr/local/Imatest/v25.1/IT/libs/library/python

macOS

cd /Applications/Imatest/IT/v25.1/libs/library/python

Inside this directory is the IT python package, named imatest_it-25.1.0-py2.py3-none-any.whl for Imatest IT 25.1.0.

Next, run the following command to install the Imatest IT Python module:

Windows (assuming you are running Python 3.9 installed in C:\Program Files\Python39)

C:\Program Files\Python39\python.exe -m pip install --find-links . imatest-it

or supply the *.whl file name to pip, for example

C:\Program Files\Python39\python.exe -m pip install imatest_it-25.1.0-py2.py3-none-any.whl

Linux

sudo python3 -m pip install --find-links . imatest-it

or supply the *.whl file name to pip, for example

sudo python3 -m pip install imatest_it-25.1.0-py2.py3-none-any.whl

macOS

sudo -H python3 -m pip install --find-links . imatest-it

or supply the *.whl file name to pip, for example

sudo -H python3 -m pip install imatest_it-25.1.0-py2.py3-none-any.whl

You will now be able to reference Imatest IT in your Python scripts using the import statement.

Step 1: Prepare Test Environment and Capture Test Targets

Imatest’s analysis modules require correctly framed and properly lit images of test targets to produce accurate results. For information on setting up your image testing environment, see this article.

Imatest offers a wide range of test charts to improve the accuracy of your image analysis.

Step 2: Configure INI File with Test Image(s)

In addition to the test image, the other important input for Imatest IT module functions is the INI configuration file, which contains settings that describe the input image (such as the ROI [region of interest]), analysis details, and output file locations. Before using Imatest IT in your application, you will need to configure one or more INI files for your specific testing needs.

Creating an INI File with Imatest Master

Imatest IT-specific INI File Settings

To configure Imatest IT-specific settings, choose Settings, then IT & Pass/Fail Settings… from the main window menu bar. For a detailed explanation of the IT-specific settings found in this window, see this article. After you have made your changes, click OK.

Image Analysis INI File Settings

Once you have an image file of your test target that matches the framing and dimensions of the tests you will run using Imatest IT, analyze it using Imatest Master with the module you require. Be sure the image has the same pixel count as the images to be used in your production environment.

Repeat the tests with different settings until you have the results you require.

Exporting the INI File

Once you have configured the IT settings to meet your requirements– including the Region of Interest (ROI), calculation details, output file and folder locations– you can go back to the main Imatest window, and choose INI File Settings then Save Settings… from the menu bar. Choose a location for the INI file and give it a useful name. This file name will be the second input parameter when calling Imatest IT module functions.

In Imatest you can use the  Save ini file for  button in the Imatest IT settings window to save an ini file with only the needed sections.

 

You can create a file to control up to four modules by selecting the module in each of the boxes on the left, then pressing Save ini file for. The ini section(s) for the module ([sfr] and [sfrreg] in the above example) is included, along with [imatest], [api], [dcraw], [rdraw], and [sqf] and [visnoise], where appropriate.

Step 3: Integrate and Call Imatest IT Modules

Now that your test images and INI files have been prepared, you can integrate your application and analyze the images using Imatest IT’s module functions.

Select your preferred interface below to see detailed instructions.

Interface Type:

Note: Imatest only supports 64-bit architectures. You must use the 64-bit version of Python when using Imatest IT.

Calling the Imatest IT Python Interface

At the top of your script file, include this line to import the ImatestLibrary class from the imatest.it module:

from imatest.it import ImatestLibrary

Next, create an instance of the ImatestLibrary class. Behind the scenes, the ImatestLibrary constructor will start up the Matlab MCR Runtime and load all the IT libraries into memory. This will take a few seconds the first time you run it, but should be faster on subsequent runs, especially if you have set your system’s environment variables to the recommended values as described above.

from imatest.it import ImatestLibrary
 
imatestLib = ImatestLibrary()
[/python]
Now that the Matlab MCR and Imatest IT library are all ready to go, the next step is the prepare the arguments that will be passed into the IT module functions. Each of the IT modules has the same method signature (with the exception of OIS). In this example, we will use the <b>sfr</b> function. The signature for the SFR module function looks like this:
[python][/python]
sfr(input_file=None, root_dir=None, op_mode=None, ini_file=None, raw_data=None, json_args=None)

The Imatest IT Python library parameters are listed here:

Parameter Name Data Type Description
input_file string or list Image file path. A full path name may be used (and is recommended), such as “C:\Program Files\Imatest\v25.1\IT\samples\images\sfr_example.jpg”. If a relative path name is used, the path is relative to your calling program, not the value of the root_dir parameter. Multiple files can be analyzed by passing in a list of file names, or by using a wildcard (*) symbol in the path. For example, if the input_file parameter is “C:\Imatest\iPhone6_*.jpg”, all .jpg files in the folder C:\Imatest with filenames beginning with “iPhone6_” will be analyzed.
root_dir string Directory containing your INI file. If you do not pass a file path in as the ini_file parameter, then Imatest IT will use a file named imatest-v2.ini found in this directory as your INI configuration.
op_mode string String containing one of the following operation codes, which tells Imatest IT how to analyze your image(s), or if you are using Direct Read mode. Valid values for the op_mode parameter are found in constants of the ImatestLibrary class: ImatestLibrary.OP_MODE_SEPARATE, ImatestLibrary.OP_MODE_SIGNAL_AVERAGE, ImatestLibrary.OP_MODE_TEMPORAL, and ImatestLibrary.OP_MODE_DIRECT_READ. For more information on the different op modes supported by Imatest IT, see this article.
ini_file string (optional) If you want to use an INI file that is not named imatest-v2.ini, you will need to supply the path to the file as the ini_file parameter.
raw_data string (optional) The raw image data. Only used when using OP_MODE_DIRECT_READ. For more information on direct read mode, see this article.
json_args string (optional) A JSON string containing metadata about how to interpret the image in the raw_data parameter. Only used when using OP_MODE_DIRECT_READ. For more information on direct read mode, see this article.

Calling Imatest IT Modules

Now that the library is initialized, and all of the input parameters are set up, it is time to call the Imatest IT analysis function. This example uses the SFR module, but the same code can be used to call the rest of the Imatest modules (with the exception of OIS, which has different inputs).

It’s easiest to call the sfr using named parameters, as shown below. An exception will be thrown if something goes wrong – you should catch it and handle it gracefully. Check the exception message and stdout and stderr streams for details on what went wrong, and see the Error Handling section below for more information on gracefully handling exceptions.

When the call is successful, the function will return a string containing JSON-encoded output.

from imatest.it import ImatestLibrary
import json
 
imatestLib = ImatestLibrary()
 
result = imatestLib.sfr(input_file=input_file,
                        root_dir=root_dir,
                        op_mode=ImatestLibrary.OP_MODE_SEPARATE,
                        ini_file=ini_file)
print(result)

When you are finished making calls to the Imatest IT Python library, you then need to call terminate_library() to unload the library and the Matlab Runtime.

imatestLib.terminate_library();

Running the Imatest IT Python library on macOS

Note: Due to a limitation in how the IT Python library is constructed, you must call any python code via the mwpython.sh script provided by Mathworks at /Applications/MATLAB/MATLAB_Runtime/R2024a/bin. It is recommended that you set the PYTHON_HOME environment variable if you wish to use a particular python interpreter. Also, the only supported means to call mwpython is to call a script directly (not a module using the -m flag in python). For example

export PATH=/Applications/MATLAB/MATLAB_Runtime/R2024a/bin:$PATH
export PYTHON_HOME=/Library/Frameworks/Python.framework/Versions/3.7
mwpython some_script.py

Step 4: Process the Results

The Imatest IT module functions output their results as JSON, XML, and CSV formatted text files. The C, C++, Python, and .NET libraries also return results as a JSON formatted string to the calling program.

Using the JSON Result in Code

Imatest IT’s JSON result string, which is returned to the calling program, can be parsed and processed using third party JSON libraries. A list of JSON libraries for several languages can be found at json.org.

The result strings are packaged as nested property/value objects, and the first property is always [module]Results, as seen in this excerpt from an SFRplus call:

View JSON Results

Note: If you analyze multiple files in a single call, only the last file’s results will be returned to the calling program. The others will be written to output files in the Results directory.

If you find that a result you need is missing from the returned JSON, please contact us and we can add it in the next minor release of Imatest IT.

Imatest IT Output Files

Imatest IT also writes its results to text files, which are formatted in XML, CSV, and JSON. By default, these files are written to a Results folder in the same folder as the images themselves. You can change the location by using Imatest Master to change your INI configuration settings, in the Auto mode settings for the modules you will be using:

 

Performance Tip: If you do not need some or all of the output files, you can disable them using the same Auto mode settings window. This will make your Imatest IT calls run a little faster. Just uncheck each of the outputs that you do not require.

Error Handling

Select your preferred interface below to see the best ways to handle errors using Imatest IT.

Interface Type:

In the Imatest Python library, if an error occurs within one of the analysis module functions, an ImatestException will be thrown. If you catch the exception, then you can get more information about using the error_id, error_name, and message properties.

Here is an example of how you can catch and gracefully handle exceptions using the Imatest IT Python Library. You can use the constants on the ImatestException class to handle certain error types in different ways. In this example, an ImatestException will be thrown because all floating license seats are currently being used:

from imatest.it import ImatestLibrary, ImatestException
...
try:
    result = imatestLib.sfr(input_file=input_file,
                            root_dir=root_dir,
                            op_mode=ImatestLibrary.OP_MODE_SEPARATE,
                            ini_file=ini_file)
except ImatestException as ex:
    if iex.error_id == ImatestException.FloatingLicenseException:
        print("All floating license seats are in use.  Exit Imatest on another computer and try again.")
    elif iex.error_id == ImatestException.LicenseException:
        print("License Exception: " + iex.message)
    else:
        print("*** Error calling sfr: %s" % (iex.message, ))

Sample Code

Imatest IT ships with several example projects in C++, Objective-C (macOS only), Python, C#, and Visual Basic. You can find them in the samples folder of your IT installation, along with example images of Imatest test charts that can be used for each of IT’s analysis modules.

Imatest IT for Windows also comes with a sample GUI application that demonstrates integrating the IT .NET libraries in a full-featured GUI application. Using the example images provided in the samples folder, you can experiment with the different analysis modules. It also provides a simple way to interact with the Imatest Acquisition Library. Using this app, you can quickly connect and test any of the supported image capture devices and make sure they are working, without writing any code. The full source code for this app is included in the .NET C# samples folder.The available log levels are:

Advanced Topics

Direct Read Mode and Reading RAW Images

Images can be passed directly into Imatest IT as byte arrays using Direct Read Mode. The images can be processed RGB or RAW. Direct Read Mode is generally much faster than passing in image file paths, since the data is already in memory and does not need to be read from disk. Although it does require more initial setup effort, if your application is speed-critical or high-volume, we strongly recommend using Direct Read Mode.

For detailed instructions on using Imatest IT’s Direct Read Mode, see this article.

Using the Imatest Image Acquisition Library

Images can be directly acquired in your application from supported devices using the Imatest IT Acquisition Library (C, C++, and .NET only).

For more information on the C and C++ version of the Acquisition Library, see this article. For the .NET version, see this article.

Using Pass/Fail Metrics

Pass/Fail results are included in the JSON results for those modules that support it (Blemish, Colorcheck, Distortion, Multitest, SFR, SFRplus, eSFR-ISO, Random, Star, Stepchart, and Uniformity). If you have configured Pass/Fail criteria, and included the Pass/Fail file in your INI file, then the tests will be run, and the results will be included as a separate JSON object called “passfail”.

For more information on implementing Pass/Fail in Imatest, see this article.

Logging Levels and Redirecting Output

By default, the Imatest IT modules print some information to the standard output or console. Logging levels control the nature of the output (to standard out and to log file) and may be selected by INI file control or from the Settings menu on the main window of Imatest Master.

If your application does not have a console, or you want to store this output in another way, it is possible to redirect the standard out and standard error outputs.

Select your preferred interface below to see detailed instructions.

Interface Type:

To redirect output text using the Imatest Python library, you need to pass in StringIO objects to the ImatestLibrary() constructor, as the stdout and stderr named parameters. You can extract the contents of these objects using the getvalue() method, and should call close() on them at the end of your script.

import StringIO
 
std_out = StringIO.StringIO()
std_err = StringIO.StringIO()
 
libImatest = ImatestLibrary(stdout=out_file, stderr=err_file)
# Call library methods …
print std_out.getvalue()
print std_err.getvalue()
std_out.close()
std_err.close()

Parallel Processing

Imatest IT now allows you to analyze several different images in parallel,
using the new parallel_analyzer function.

Interface Type:

Imatest IT allows you to analyze several different images in parallel, using the new parallel_analyzer function.

To use the parallel_analyzer, first create a list of analysis tasks that need to be run. Each task will be assigned to a different parallel process. The number of available concurrent processes depends on how many cores your machine has, though you can tell Imatest IT to use fewer cores if you need.

To create an analysis task, use the new_parallel_task function:

ImatestLibrary.new_parallel_task(image_files=None, image_data=None, analysis_type=None, image_data_meta_data=None)
Parameter Name Data Type Description
image_files str or list of strs Either a file path to an image, or a list of file paths
image_data str/bytes or array.array (numerical) If you are providing raw image data, use this argument, which is either the read value of the image in str (Python 2.7) or bytes (Python 3.6, 3.7) form. If using image_data, you must include the image_data_meta_data argument, which you can get by calling ImatestLibrary.build_json_args()
analysis_type enum A flag telling Imatest IT which module to run. Valid values are constants on the ImatestLibrary class: ImatestLibrary.BLEMISH_ANALYSIS ImatestLibrary.CHECKERBOARD_ANALYSIS ImatestLibrary.COLORCHECK_ANALYSIS ImatestLibrary.DISTORTION_ANALYSIS ImatestLibrary.DOTPATTERN_ANALYSIS ImatestLibrary.ESFRISO_ANALYSIS ImatestLibrary.MULTITEST_ANALYSIS ImatestLibrary.RANDOM_ANALYSIS ImatestLibrary.SFR_ANALYSIS ImatestLibrary.SFRPLUS_ANALYSIS ImatestLibrary.SFRREG_ANALYSIS ImatestLibrary.STAR_ANALYSIS ImatestLibrary.UNIFORMITY_ANALYSIS ImatestLibrary.WEDGE_ANALYSIS
image_data_meta_data dict A dict object containing the direct read meta data, used to help interpret the raw byte data, and obtained by calling ImatestLibrary.build_json_args(). Required if using the image_data argument, not needed if using image_files.

add each of your tasks to a list, then call ImatestLibrary.parallel_analyser, passing in the path to your INI file, True for run_parallel, and the number of worker processes you’d like to use:

ini_file = r'C:\images\ini_file\imatest-v2.ini'
 
tasks = []
tasks.append(library.new_parallel_task(image_files=r'C:\images\sfrplus_0123.jpg', analysis_type=ImatestLibrary.SFRPLUS_ANALYSIS))
tasks.append(library.new_parallel_task(image_files=[r'C:\images\blemish_0001.jpg', r'C:\images\blemish_0002.jpg', r'C:\images\blemish_0003.jpg'], analysis_type=ImageLibrary.BLEMISH_ANALYSIS))
....
 
result = library.parallel_analyzer(tasks=tasks, ini_file=ini_file, run_parallel=True, num_workers=4)

The result will be a JSON encoded string that can be parsed into an array of result objects using json.loads(result). Each result object has this form:

{
   "data": {
      "dateRun": "18-Sep-2017 10:26:59",
      "ini_file_name": "C:\\images\\ini_file\\imatest-v2.ini",
      "ini_time_size": "18-Sep-2017 10:26:45 21822B  MD5 = ac109f86b635bd5b4344d252969e64a7",
      "version": "Imatest 5.0.0  SFRplus",
      "title": "sfrplus_0123.jpg",
      "image_path_name": "C:\\images\\sfrplus_0123.jpg",
 
      ...
   },
   "errorID": "",
   "errorMessage": "",
   "errorReport": ""
}

If any exceptions occurred during processing, they will be reported in the errorID, errorMessage, and errorReport properties. While handling your results, you should always check whether the errorID property is empty or not before working with the data property:

resultArr = json.loads(result)
 
for task_result in result_arr:
   if task_result['errorID']:
      # Gracefully handle the error
   else:
      result_data = task_result['data']
      # Process the results in the result_data dictionary

Arbitrary Charts Module

Imatest IT now allows you to call the Arbitrary Charts module in using the new arbitrary_charts functions. For more information on the Arbitrary Charts modules, see this article.

 

Interface Type:

First, create an image options dictionary by calling ImatestLibrary.get_arbitrary_charts_options():

ImatestLibrary.get_arbitrary_charts_options(self, width=None, height=None, encoding=None, filename=None, extension=None, pixel_size=None)
Parameter Name Data Type Description
width int Image width (in pixels)
height int Image height (in pixels)
encoding str The pixel encoding (i.e., “srgb”, “intensity”)
filename str (direct read only) The name of the file, used for results file names.
extension str (direct read only) The extension key used to decode the direct read image bytes, as configured in the Read Raw screen of Imatest Master.
pixel_size enum (direct read only) The pixel size of the direct read image. Use one of these constants: ImatestLibrary.PIXEL_SIZE_8_BIT_UNSIGNED ImatestLibrary.PIXEL_SIZE_16_BIT_UNSIGNED ImatestLibrary.PIXEL_SIZE_32_BIT_UNSIGNED

Once you have the options object, you can then call the one of the arbitrary_charts functions:

ImatestLibrary.arbitrary_charts_separate(self, image_files=None, image_data=None, chart_file=None, ini_file=None, options=None)
ImatestLibrary.arbitrary_charts_signal_average(self, image_files=None, image_data=None, chart_file=None, ini_file=None, options=None)

The arbitrary_charts_separate function will analyze multiple inputs separately, while the arbitrary_charts_signal_average function will combine two images’ results into a single signal averaged result.

Parameter Name Data Type Description
image_files str or list of strs Either a file path to an image, or a list of file paths
image_data str/bytes or array.array (numerical) If you are providing raw image data, use this argument, which is the read value of the image in bytes (Python 3.9, 3.10, 3.11, 3.12) form. If using image_data, you must include the required parameters into the ImatestLibrary.get_arbitrary_charts_options() method
chart_file str The path to the chart definition file.
ini_file str The path to the INI file.
options dict The dict object returned by calling ImatestLibrary.get_arbitrary_charts_options().

The result will be a JSON-encoded string, which can be converted to a dict using json.loads(), of this form:

{
    "Info": {
        "Timestamp": "04-Oct-2017 09:09:08",
        "Version": "Imatest 5.1.0.25883 Alpha ",
        "Build": "2017-10-03",
        "Calculation_time_seconds": [44.36107732]
    },
    "Results_array_sources": "C:\\images\\P1858_combination_chart_example.jpg",
    "Results": {
     ...
    }
}

Concentric Rings Module

Interface Type:

Stray Light Module

Interface Type:

Troubleshooting