Extract Line Subsegment
Overview
This transform extracts a portion of a line (a subsegment) based on specified start and end points.
Detailed Description
This transformation allows for the precise extraction of a subsegment from a series of lines, such as those representing the movement of a tracked object over time. You can define the start and end of the subsegment as a fraction of the total line length. For example, you can extract the middle 50% of a line.
This is particularly useful for focusing analysis on a specific part of a trajectory or shape. For instance, in neuroscience, you might use this to analyze the movement of an animal’s limb, focusing only on the part of the movement where the limb is closest to a target.
The extraction can be done in two ways:
- Direct: This method pulls the original points from the line that fall within the specified subsegment. This is fast and preserves the original data points.
- Parametric: This method fits a polynomial to the line and then generates a new, smooth subsegment with a specified number of points. This is useful for standardizing the length and spacing of the subsegment for further analysis, such as comparing shapes across different trials.
Neuroscience Use Cases
- Whisker Tracking: When analyzing whisker movements, you might want to extract only the portion of the whisker closest to an object it’s exploring.
- Limb Tracking: In studies of motor control, you could extract the segment of a limb’s trajectory during a specific phase of a reach-to-grasp movement.
- Neural Arborization: When analyzing the structure of neurons, this transform could be used to isolate specific dendritic or axonal segments for morphological analysis.
Parameters
This transform has the following parameters:
start_position
: The starting point of the subsegment, as a fraction of the total line length (from 0.0 to 1.0).end_position
: The ending point of the subsegment, as a fraction of the total line length (from 0.0 to 1.0).method
: The extraction method to use. This can be:Direct
: Directly extracts the original points within the subsegment range.Parametric
: Uses polynomial interpolation to create a new, smooth subsegment.
polynomial_order
: (Parametric method only) The order of the polynomial to fit to the line. A higher order can capture more complex curves but may also be more sensitive to noise.output_points
: (Parametric method only) The number of points to generate in the output subsegment.preserve_original_spacing
: (Direct method only) If true, the subsegment will consist of the original points from the line that fall within the specified range. If false, the subsegment will be resampled to have evenly spaced points.
Example Configuration
Here is a complete example of a JSON configuration file that could be used to run this transformation. This example extracts the subsegment from 20% to 80% of the line’s length using the Direct
method.
[
{
"transformations": {
"metadata": {
"name": "Line Subsegment Extraction Pipeline",
"description": "Test line subsegment extraction",
"version": "1.0"
},
"steps": [
{
"step_id": "1",
"transform_name": "Extract Line Subsegment",
"phase": "analysis",
"input_key": "test_line",
"output_key": "extracted_subsegments",
"parameters": {
"start_position": 0.2,
"end_position": 0.8,
"method": "Direct",
"preserve_original_spacing": true
}
}
]
}
}
]