Command line interface - 3dct/open_iA GitHub Wiki

All image/volume processing filters available in open_iA can also be run from the command line via the open_iA_cmd executable (open_iA_cmd.exe under Windows). In the following, > denotes the command prompt (don't type this character yourself). On Linux, you'll have to prepend open_iA_cmd with ./ in order to make the shell find the command in the current folder.

Execute open_iA_cmd without parameters to see the available options:

> open_iA_cmd
open_iA command line tool, version 2018.12.
Usage:
  > open_iA_cmd (-l|-h ...|-r ...|-p ...)
Options:
     -l
         List available filters
     -h FilterName
         Print help on a specific filter
     -r FilterName -i Input -o Output -p Parameters [-q] [-c] [-f]
         Run the filter given by FilterName with Parameters on given Input, write to Output
           -q   quiet - no output except for error messages
           -c   compress output
           -f   overwrite output if it exists
         Note: Only image output is written to the filename(s) specified after -o,
           filters returning one or more output values write those values to the command line.
     -p FilterName
         Output the Parameter Descriptor for the given filter (required for sampling).

As the output above tells you, you can list all available filters via the -l command:

> open_iA_cmd -l
Available filters:
ASTRA Forward Projection
        Forward Projection with the ASTRA Toolbox

ASTRA Reconstruction
        Reconstruction with the ASTRA Toolbox

Free Beam Intensity
        Convert the intensity values to attenuation values via free beam intensity transform.

...

To run a specific filter, use the -r FilterName option. In the list of available filters, the FilterName is always the first, non-indented name specified. If it contains spaces or other special characters, you need to enclose it in quotes in all future commands. Let's say we want to add some Gaussian noise to an image. For this, there is an "Additive Gaussian" filter. Let's first see its description and parameters:

> open_iA_cmd -h "Additive Gaussian"
Additive Gaussian:
Adds additive gaussian white noise to an image.
To each pixel intensity, a value from a normal distribution with the given Mean and Standard deviation is added.
For more information, see the Additive Gaussian Noise Filter in the ITK documentation.
Parameters:
    Mean Continuous default=0
    Standard deviation Continuous min=2.22045e-16 default=0.1

This shows that the "Additive Gaussian" filter has two parameters: The first is called "Mean", it is a continuous value (i.e. floating point, in contrast to discrete = integer), which has no limitations regarding its range. The parameter "Standard deviation" is also continuous, but it needs to be positive (see the value given for min, which is the minimum positive value a double can represent). Mean's default value is 0, and for the standard deviation, it is 0.1. To run the filter, we need to specify values for both parameters, as well as input and output filename, like this:

> open_iA_cmd -r "Additive Gaussian" -i test-in.mhd -o test-out.mhd -p 100 10
Reading input file 'test-in.mhd'
Running filter 'Additive Gaussian' with parameters: 
    Mean=100
    Standard deviation=10
|                                                  |
 ..................................................
Writing output 0 to file: 'test-out.mhd' (compression: off)

You will see a progress bar updating as the filter proceeds, and after the filter is done, its output will be written to the filename given after the -o switch.

You can view the result e.g. in open_iA:

open_iA test-out.mhd