No Need for Graphics? No Problem!

  • Jun 29, 2020
  • Blog Post
Systems Tool Kit (STK) is known for both its analysis and visualization capabilities. While visualization can be compelling in communicating your analysis, sometimes you may need to prioritize calculation speed with no need for 2D or 3D visualization. If this applies to you, you can use the NoGraphics mode in your custom code for faster load times and a lighter memory footprint.
Using the STK Object Model, you can activate the NoGraphics mode by changing a few simple lines of code. But keep in mind that when this option is turned on, all 2D and 3D graphics support is skipped and the code and libraries related to graphics do not get loaded into memory. Without graphics properties, STK does not spend resources managing fonts, models, textures, etc. The creation of background threads to perform those operations is also avoided.
In the attached example, I altered the basic tutorial code for integrating STK with MATLAB and changed the initialization lines of code to enable NoGraphics mode.
     %% NoGraphics mode
     % Before instantiating AgStkObjectRoot an instance of AgSTKXApplication or an STK X      control must be created.
     % This also requires a STKX license to be present

     STKXApplication = actxserver('STKX11.application');
     STKXApplication.NoGraphics = true;
     root = actxserver('AgStkObjects11.AgStkObjectRoot');

Beware that once STK is in NoGraphics mode, any attempt to use APIs related to graphics will fail and result in the following error:
     Invoke Error, Dispatch Exception:
     Description: NoGraphics property is set to true, Graphics are not available.

After commenting out any references to ‘Graphics’ or ‘VO’, I was able to run the attached example and compare the resultant times of completion. Although the performance improvement will vary depending on your computer, using the NoGraphics mode can significantly reduce your script’s computation time.

Related Content

Systems Tool Kit (STK)

The most important thing on your desktop.

Read More

Karynna Tuan