Scripting in Mira: The Mira Pro Script Module

Develop and implement custom analyses and processing procedures in Mira Pro x64 that run at the speed of your computer.

In the mid 1990's we anticipated the benefits of using an object oriented, class-based scripting solution for working with large images and high-dimensionality data arrays. This culminated in our Pro Script� module included with Mira Pro x64. The Mira Pro Script module provides a powerful and extensible, yet easy to use platform for general computational and data processing applications. Mira Pro script implements the Lua language which is widely used in gaming and configuration applications such as Adobe Photoshop. Lua is a modern programming language with a syntax similar to Python but with an extremely powerful yet remarkably simple syntax.

Key Features

One feature that makes Mira Pro Script so powerful is its unique integration between unparalleled GUI capabilities and scripting:

  • Run scripts directly from Mira desktop windows and data.

  • Run scripts independent of Mira windows and data.

  • Access Mira desktop windows and data from scripts.

  • Create Mira GUI windows with data for use by the GUI.

In addition to the richness built into the Lua language, Mira Pro Script adds an extremely large collection of higher level tools:

  • Some 50 easy to use object-oriented classes

  • Nearly 1000 class methods

  • Several hundred non-class functions

The Mira Pro Script design means performance as well as capability:

  • Numerically intensive class methods and functions use Mira's optimized array functions for quick numeric processing.

  • Scripts are compiled to byte-code at execution time, making execution far faster than interpreted scripting languages.

Extensibility:

  • Mira Pro Script can be easily extended using your own classes, methods, and functions.

  • A rich selection of 3rd party tools are available for inclusion in your scripts.

 

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.

Overview

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.org.

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

Organization

Telephone

Application

Comments

Verification *