Figure 7f. Workflow for the segmentation algorithm