# Recipe Sequencer

This is an experimental module from the Xtra Library: https://www.thermofisher.com/software-em-3d-vis/xtra-library/.

This module enables the application of a recipe to each individual label within a labelfield by iterating through the sequence label-by-label. Many segmentation and post-processing operations—such as convex hull generation—are meaningful only when applied to a single binary object. Executing the same workflow manually for multiple objects can therefore be cumbersome.
The core principle of the Recipe Sequencer is to iterate over all labels, in either 3D or 2D, and extract each label into a temporary working volume. The specified recipe is then applied to this working volume.
After execution, the processed result is either written back into the result volume while preserving the original label ID (“To memory”), or exported as individual files into a designated directory (“To disk”).
The module also provides an option to dilate the temporary label before applying the recipe. This can help mitigate edge-related artifacts that may arise when performing morphological operations. Additionally, users may supply a Label Analysis result table that includes each object’s extent. The following attributes must be present:

- BoundingBoxOx
- BoundingBoxOy
- BoundingBoxOz
- BoundingBoxDx
- BoundingBoxDy
- BoundingBoxDz

When this information is available, the module can skip the computation of label extents, resulting in improved performance.

## Known Limitations

- The Recipe Sequencer only allows to have one Label Field as input and it will create only one Label Field as the unique output, only when output type "To memory" is selected.
  When output type "To disk" is selected all the recipe results are saved into a specific directory instead.
- Output type "To disk" can only be executed in 3D.
- This module is only available on Microsoft Windows platforms

## Connections

Data: [required] | Only inputs of type Label Field are supported at this point.
Label Analysis: [optional] | Label Analysis result table that provides information about each object’s extend (following attributes must be available in such a result table): BoundingBoxOx BoundingBoxOy BoundingBoxOz BoundingBoxDx BoundingBoxDy BoundingBoxDz If not all of the above attributes can be found in the Label Analysis result table, the port will be disconnected.

## Parameters (Ports)

Recipe: | Use this port to select the .hxrecipe filename containing the recipe to sequence.
Output type: | Use this port to either create an output corresponding to the input updated with the modified labels, or to save the recipe results into a specific directory instead.
Output directory: | Use this port to select the output directory when output type "To disk" is selected..
Interpretation: | Use this port to sequence the recipe either in 3D or 2D. In 2D the recipe will be sequenced slice by slice and extract each label from the slice that is present in the current slice prior to recipe application. This port is ignored when selected output type is "To disk": 3D interpretation is then automatically set.
temp. Dilation: | Use this port to add boundary voxels to the sub-volume before applying the recipe on it. This prevents artifacts that may happen close to the edges when applying e.g. morphological operations