# Choose Line

This function block helps you pick a single line from inside a contour and provides geometric information about that line. It visualizes the contour and its points, lets you select which segment to measure, and outputs the line shape, end points, length and angle — all in an easy-to-use interface for non-coders.

## 📥 Inputs <a href="#inputs" id="inputs"></a>

`Image Any` The image where the contour and selected line will be drawn and shown.

`Contour` The contour (shape) from which a line segment is chosen.

(These are the input sockets for the block.)

## 📤 Outputs <a href="#outputs" id="outputs"></a>

`Generic Image` The image with the contour, points and the chosen line drawn for visual confirmation.

`Length` The measured length of the chosen line segment in pixels.

`Point 1` Coordinates of the first end point of the chosen line.

`Point 2` Coordinates of the second end point of the chosen line.

`Angle` Orientation of the chosen line in degrees.

`Line` The selected line represented as a shape output.

(These are the output sockets the block provides.)

## 🕹️ Controls <a href="#controls" id="controls"></a>

`Line selection dropdown` Choose which consecutive point pair (line) inside the contour to use.

`Line properties label` Shows textual information about the currently selected line, such as end points, length and angle.

(These controls appear on the block interface and are interactive.)

## 🎯 Features <a href="#features" id="features"></a>

* Interactive contour visualization with all contour points marked.
* Simple dropdown to pick one line segment formed by consecutive contour points.
* Immediate visual feedback: contour, points and selected line are drawn on the output image.
* Numeric outputs for length and angle so you can feed measurements into further processing.
* Produces a shape output representing the chosen line for downstream blocks that accept shapes.

## ⚙️ How it runs <a href="#running-mechanism" id="running-mechanism"></a>

* When a valid `Contour` is provided, the block lists selectable line segments based on the contour points.
* The block draws the contour and marks each point. Selecting an entry from the `Line selection dropdown` highlights the corresponding segment.
* The block computes the Euclidean distance between the two selected points and the line angle, updates the `Line properties label` and returns the visual image and numeric shape/point outputs.
* If no contour is present the block returns the input image unchanged and resets the text in the properties label.

## 📝 How to use <a href="#usage" id="usage"></a>

1. Provide a processed image to `Image Any` (usually an image where contours are already found).
2. Provide the contour shape to `Contour` (for example from a contour detection block).
3. Open the `Line selection dropdown` and pick the desired segment to inspect.
4. Read the measurement outputs `Length`, `Point 1`, `Point 2` and `Angle` or pass `Line` to downstream blocks.

## 💡 Tips and Tricks <a href="#tips-and-tricks" id="tips-and-tricks"></a>

* Use the Find Contour block to supply reliable contours into the `Contour` input.
* If you need a simpler contour before choosing a line, try `Approximate Contour` to reduce the number of points and make selection easier.
* To inspect a cropped area only, precede this block with `Image ROI Select` or `Get ROI` so the contour and line are measured in the region that matters.
* To extract the chosen line area for further processing (for example template matching or histogram checks), feed the `Generic Image` output into blocks like `Contour to Image` or `Image ROI`.
* Combine with `Draw Line`, `Draw Point` or `Draw Rectangle` blocks if you want to overlay additional annotations on the output image before presenting or saving.
* Feed numeric outputs such as `Length` and `Angle` into analysis or logging blocks (for example `CSV Export` or `Data to JSON`) to record measurement results.

## 🛠️ Troubleshooting <a href="#troubleshooting" id="troubleshooting"></a>

* If the dropdown shows no selectable lines, confirm that a valid contour was provided by the previous block (contour should contain multiple points).
* If selected indices seem out of range, try running a contour simplification (`Approximate Contour`) or ensure the input image and contour correspond to the same crop/coordinate space.
* If measurements seem incorrect, verify that the image used was not resized or padded earlier in the flow; if it was, use matching ROI or resize steps so coordinates align.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.augelab.com/function-blocks/detections-shapes/shape-analysis/choose-line.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
