Adding Custom Code

ImageTank can function as a high-level programming environment. ImageTank has a lot of built-in actions, but can also be used to create custom actions or computations. ImageTank can even be used to call external programs. The primary way to add your own code is through the Task menu in the toolbar. This allows you to call a command line utility, and ImageTank has several ways to help you write and debug code.

At the top level there are two ways to call external programs, let’s call them ‘Action‘ and ‘Task‘.

  • You can create an Action which will work the same way as most entries in ImageTank. That is, every time you change the input the external program will be called to get the output. Note that this still follows the basic rule of ImageTank, i.e. that the program only computes the output if you need it. You can abort the program if it is taking too long, but anytime you change the input the action will be run to update the output.
  • You can create a Task that will work like you would expect a standard terminal program to work. You decide when to start the execution, and the program will use the current value of the input parameters. Once it has started you can modify the input but that will not automatically restart the task. ImageTank will constantly monitor the output from the task and update it in the background. More information.

Some examples of how you would use these two approaches.

  • If you want to define your own smoothing algorithm for an image, use the Action method.
  • If you are solving an ODE and want to run multiple realizations use an Action method.
  • If you want to run a time dependent PDE, that may take a while to run to completion, and you want to see a time evolution of a problem as the problem is running, use the Task method.
  • If you want to create a tracker that takes in a time sequence of results and creates a combined path either as a single value or another time sequence use the Task method.

The C++ code assumes that you use the C++ library DTSource, that is included inside the ImageTank wrapper. This library is cross platform and doesn’t depend on any compiled library. Thus, you can then use this library more widely and independent of ImageTank. The library will make communication between ImageTank and your C++ code a lot easier. See the DTSource page to get more information.

To understand how to create external tasks go through the following steps.

  • Simple Group start with this. The other documents will assume you know the basic steps like creating an Xcode project, building debugging. This creates an Action, but many of the steps are the same for the Task so read this first.
  • To get started with an external task go through the Heat Equation example. A very simple implementation of the heat equation. Shows how to create a task and run it. Goes through how to use it from the debugger and how to connect to the output.