Smart Acquisition Routines

navigate’s feature container lets you build acquisition routines by chaining existing features into lists. See Currently Implemented Features for the complete list. You can also build additional features as plugins.

One common problem in light-sheet microscopy is wasting time acquiring z-stacks in empty space. With the feature container, you can build a routine that checks for tissue at each position and only acquires z-stacks where tissue is detected. This section walks through building such a routine.

Prerequisites

Before starting this guide:

  1. Complete Software Installation.

  2. Complete Configuring navigate, or launch with navigate -sh to use virtual devices.

  3. Add at least two entries in the multiposition table so one can represent tissue and one can represent empty space.

Example Setup

The example below assumes two positions in the multiposition table: one with tissue and one without tissue.

Multiposition table. One position will have tissue, and the other will not.

Step 1: Create the Base Feature List

  1. Go to Features ‣ Add Customized Feature List.

  2. In the Add New Feature List window, enter TestFeature in the name field.

  3. In the lower editor, enter:

[{"name": PrepareNextChannel}]
  1. Click Preview.

Feature list editor showing PrepareNextChannel as the first node.

Tip

Checkpoint: the preview should show one node, PrepareNextChannel.

Step 2: Add Position Traversal

  1. Right-click PrepareNextChannel and select Insert After.

  2. Confirm a second placeholder node appears after PrepareNextChannel.

  3. Click the new node and choose MoveToNextPositionInMultiPositionTable.

Feature list showing a second placeholder node inserted after PrepareNextChannel.
  1. Configure the new node. Here, one can set the resolution_value, zoom_value, and offset.

Feature selection popup used to choose MoveToNextPositionInMultiPositionTable.
  1. Close the node selection popup.

Feature list showing PrepareNextChannel followed by MoveToNextPositionInMultiPositionTable.

Tip

Checkpoint: the routine should now take one image per multiposition entry in the first selected color channel.

Step 3: Add Tissue Detection

  1. Right-click MoveToNextPositionInMultiPositionTable and select Insert After.

  2. Set the new node to DetectTissueInStackAndReturn.

DetectTissueInStackAndReturn settings in the feature list editor.
  1. Configure the DetectTissueInStackAndReturn node with the following parameters:

    1. planes: number of z-planes checked for tissue.

    2. percentage: required image fraction containing tissue to return true.

    3. detect_func: tissue detection function from remove_empty_tiles. If set to None, navigate uses detect_tissue().

Tip

Checkpoint: the routine now evaluates each position for tissue before deciding what to acquire.

Step 4: Add Loop Control

  1. Right-click DetectTissueInStackAndReturn and select Insert After.

  2. Set the new node to LoopByCount.

  3. Set steps to experiment.MicroscopeState.multiposition_count.

  4. Group the repeated section in parentheses () and click Preview.

LoopByCount node inserted after tissue detection.
  1. Confirm that the displayed routine shows the looped section in the graphical user interface.

Preview showing the looped section enclosed in parentheses.

Tip

Checkpoint: the repeated segment should be visually grouped as a loop in preview.

Step 5: Convert Tissue Detection to a Decision Node

  1. Add true and false branches to the DetectTissueInStackAndReturn node:

{
    "name": DetectTissueInStackAndReturn,
    "args": (1, 0.5, None),
    "true": [{"name": ZStackAcquisition, "args": (False, False, "z-stack")}],
    "false": "continue",
}
  1. Click Preview.

  2. Click the node to open the decision editor and verify both branches.

Feature list preview showing DetectTissueInStackAndReturn as a decision node.

Tip

Checkpoint: DetectTissueInStackAndReturn should have a red border, indicating decision-node behavior.

Step 6: Save and Run the Routine

  1. Click Add in Add New Feature List.

  2. Select Features ‣ TestFeature.

  3. Set acquisition mode to Customized.

  4. Click Acquire.

For the two example positions above, the software should acquire a z-stack at the tissue position and skip z-stack acquisition at the empty position.

Complete Example

The snippet below is a full, copy-ready template that matches this workflow:

[
    {"name": PrepareNextChannel},
    (
        {"name": MoveToNextPositionInMultiPositionTable},
        {
            "name": DetectTissueInStackAndReturn,
            "args": (1, 0.5, None),
            "true": [
                {"name": ZStackAcquisition, "args": (False, False, "z-stack")}
            ],
            "false": "continue",
        },
        {"name": LoopByCount},
    ),
]

Note

Depending on your feature editor version, the exact argument serialization for LoopByCount may differ. If needed, set the steps field in the GUI to experiment.MicroscopeState.multiposition_count after loading the template.

You can now use this routine directly or adapt it to your microscope’s needs.