
This short demo shows several things:
1) How to calculate a layer which contains the distance to a line with the process "layer arithmetics". This serves as a demo case on how to use mathematical functions based on coordinates (_x_ , _y_) to draw figures into a layer.
2) How to use this layer to segment a line.
3) How to use the active pixel concept to react on user input
Task:
The goal of this rule set is to segment a line into the image, i.e. to separate the image into two regions with a straight line border. This can be used to:
* Do arbitrary cuts of image objects via a straight line
* Create bins with distances to a straight line
* Measure the distance to a straight line (you can also use the feature "distance to line" for this)
Process:
The attached rule sets contains a customized algorithm which takes the coordinates of two points as input parameters. Additionally, it takes an existing 32bit float layer that will contain the result. The result is a layer that has the value zero at the line that connects the two points, and the distance to the line for all other pixels. The distance can be either positive or negative, depending on the side of the line.
After the creation of this layer, the multi-threshold segmentation with threshold 0 can be used to separate the image into two image objects at exactly this line. If the segmentation is applied to an image object domain, it can be used to cut only certain image objects at this line. Additionally, by applying multiple thresholds in the multi-threshold segmentation, distance bins can be created.
How to use the rule set:
If you would like to test the attached rule set, just execute the first process. It will ask you to click on two points in the image. After that, it will create a line between them. The "active pixel" concept is used for the definition of the position where the user clicks, which might also be an interesting demo case on how to realize interactive workflows with user input.
Comments