Scripting in Mira: The Pro Script Module

Mira Pro Script provides a rich environment for scripted computation including processing, simulation, and processing extremely large images.

In the 1990's we anticipated the trend toward big images and high-dimensionality data arrays as well as the benefits of an object oriented, class-based scripting solution for efficiently working with large images and data arrays. This culminated in our Pro Script� module. The Mira Pro Script module provides a powerful and extensible, yet easy to use platform for general
computational needs as well as data processing applications, centered around the Lua language widely used in gaming and configuration applications. Lua is a modern programming language with a syntax is quite similar to Python. The Mira scripting package includes 100s of functions, dozens of object oriented classes, and some 900 methods for working with images and data. Numerically intensive functions and methods access Mira's optimized array functions for quick numeric processing. The language can be easily extended using your own code additions, including new classes, methods, and functions, and it readily integrates with a broad selection of 3rd party tools. With Mira scripting, you can develop and implement custom analyses and processing procedures that run at the speed of your machine rather than at the speed of an interpreted language.

Overcoming the Script Performance Bottleneck

How fast should your scripts run? Working with data arrays and images, hard-coded loops are used to repeat operations on large numbers of array elements. Since a script language is interpreted, this creates a significant bottleneck in performance and productivity. As a result, in applications involving large images and big data arrays, scripting languages are notoriously slow in comparison with compiled applications. If you read the Lua literature or follow user groups, you'll read much about Lua's remarkable speed, and that is why we chose it as a scripting engine.

More Information

  • Real-time processing and analysis: File Event Scripting. Automatically process files, display measurements, plots, etc., as files are created by other software.

  • What to expect: Scripting Benchmarks. View timing of common script methods for an average machine.

  • User's Guide: Script User's Guide. View the complete documentation.

  • Listing of methods included in the CImage class. This shows one of many classes provided, and the language is fully extensible for adding your own methods and classes. Also see CImage Math Operators.

  • Paper: "A Look at the Design of Lua", in Transactions of the ACM.


Mira scripts have access to tools in the Mira GUI but also may be independent of the GUI. Your script might operate on displayed images or plots or it could perform specialized image processing and display the result. Alternatively, a script also can perform computations that do not involve other Mira features. For example, you might setup a customized image processing pipeline that works with images in files. Or you might perform some particular type of filtering or measurement of a displayed image set, then analyze and plot the results. You might even write a simple script that updates the calendar for your class syllabus.

Prototyping and implementing custom image processing solutions has never been easier. Using Mira, you spend less time learning a language and more time analyzing results. With Mira scripts, scientific and technical users with even modest experience in C, C++, Java, Perl, or even Basic will find it surprisingly easy to write scripts that do serious work.

The Mira's scripting module is far more than just a script interpreter supplemented by "toolkit". By extending the Lua programming language with Mira's rich core of advanced image processing tools, Mira makes it both faster and easier for you to get to the bottom line: RESULTS. Lua provides a rich syntax with advanced capabilities that are there if you need them, but not required if you don't. In addition, when used as a scripting language, Lua has been shown to be one of the fastest available.

Mira greatly reduces the learning curve required of competing products, helping scientists and engineers to create powerful, effective software solutions with minimal effort getting "up to speed". All tools provided with Mira are pre-compiled for maximum performance and user scripts are compiled in real time to execute procedures that run at top speed — a huge benefit for mission critical applications and computations involving large images and image sets.

Key Benefits

Mira's scripting facility is designed for scientists and engineers in image processing applications. Mira helps you implement complex procedures with less time learning a language, fewer bugs, and with faster execution than with any competing platform.

  • Mira is designed around the premise that the typical user is trained in a technical field but is not a software engineer. Within minutes of first use, a typical Mira user can be writing scripts that actually do something useful. Never would you think that so much could be done with so little code!
  • Mira implements the Lua language, which is a full-featured programming language. Lua has been shown to be one of the fastest executing script languages available.
  • Scripts access Mira's extensive core of fast, optimized mathematical algorithms and array processing code.
  • Provides outstanding GUI-level interaction between scripts and Mira's rich collection of data processing and visualization tools.
  • Scripts can include code from external packages and extension modules on the fly, drawing from a rapidly expanding collection of commercial and open source tools.
  • Mira accelerates the creation of complex procedures. Scripts compile on the fly and run with minimal processing overhead.
  • Mira is truly feature-rich. In addition to the core capabilities of the Lua language, Mira's scripting module adds dozens of built-in classes and nearly 1000 functions and class methods for processing, displaying, calibrating, and measuring images and other data.
  • Nearly 200 sample scripts are included to get you up to speed. These can be used as-is or serve as starter code for your own scripts.

Recommended References

These are available from Amazon and elsewhere:

Programming in Lua, 4th Edition (2016), by Roberto Ierusalimschy. This authoritative guide to the Lua language was written by its principle architect. Disarmingly straightforward and easy to follow, this masterful work is a "must have" for learning the power of the Lua language. This may also be purchased directly from the Documentation page at

Lua Quick Start Guide (2018), by Gabor Szauer.

Lua Programming Gems (2008), ed. Luis Henrique de Figueiredo, Waldemar Celes, and Roberto Ierusalimschy. Numerous experts author chapters on programming techniques, algorithms, data structures, extending Lua using modules, and other topics.


Learn More

Name  *

E-mail  *

Item of Interest





Verification *