Side outputs#

There are cases where the output of a method is needed as the value of a parameter for a method further down the pipeline. For example, the output of a method that calculates the Centre of Rotation (CoR), that is required for a reconstruction method.

HTTomo provides a special syntax (loosely based on the syntax for references in GitHub Actions) for how such an output of a method needs to be defined and how to refer to that special output later.

Specifying the side output#

The output of some methods isn’t processed data, but rather supplementary information to be used later in the pipeline. The given term for that supplementary data is “side outputs”, and is what the side_outputs parameter is for. As an example, let us consider the following centering algorithm:

- method: find_center_vo
  module_path: httomolibgpu.recon.rotation
  parameters:
    ind: null
    smin: -50
    smax: 50
    srad: 6.0
    step: 0.25
    ratio: 0.5
    drop: 20
  id: centering
  side_outputs:
    cor: centre_of_rotation

One can see that side_outputs here includes a single value cor with the centre_of_rotation reference. The id parameter here is needed to refer to the method later.

Referring to the side output#

The purpose of side_outputs is to refer to it later, when some method(s) require the contained information in the reference. Consider this example where the reconstruction method refers to the centering method’s side outputs. The required information of Centre of Rotation (CoR) is stored in the reference ${{centering.side_outputs.centre_of_rotation}}.

- method: FBP
  module_path: httomolibgpu.recon.algorithm
  parameters:
    center: ${{centering.side_outputs.centre_of_rotation}}
    filter_freq_cutoff: 1.1
    recon_size: null
    recon_mask_radius: null

There could be various configurations when this reference is required from other methods as well. We present more verbose Example of side outputs below.

Note

Side outputs and references to them are generated automatically with the YAML generator. Usually there is no need to modify them when editing a process list.

Example of side outputs#

Pipeline overview#

This pipeline is for reconstructing DFoV data which needs to be stitched into the traditional 180 degrees data. It demonstrates three cases where a method produces one or more side outputs, and a method later in the pipeline references them.

A rough outline of the three side outputs being used is:

  1. the 360 centering method produces an “overlap” value as a side output, for the stitching method to use

  2. the 360 centering method also produces a CoR value as a side output, for the recon method to use

  3. the stats calculator method produces a global stats value as a side output, for the image saver method to use

Detailed look at side outputs usage#

Parameters for stitching are generated by find_center_360, stored in side outputs, and then used later in the sino_360_to_180 method. The reconstruction method FBP then refers to the found Centre of Rotation (CoR) for the stitched dataset produced by find_center_360. Finally, we also need to extract the global statistics for normalisation of the data using the calculate_stats method when saving into images with the save_to_images method.

Please see below for a concise description of how each of the individual side outputs of methods are connected to the method using them:

  1. find_center_360 produces a side output called overlap that the sino_360_to_180 method uses.

  2. find_center_360 produces another side output called centre_of_rotation that the FBP method uses.

  3. calculate_stats produces a side output called glob_stats that the rescale_to_int method uses.