|
4 | 4 | manipulate features in DeepTrack2, enabling users to build sophisticated data |
5 | 5 | processing pipelines with modular, reusable, and composable components. |
6 | 6 |
|
7 | | -Main Concepts |
| 7 | +Key Features |
8 | 8 | ------------- |
9 | 9 | - **Features** |
10 | 10 |
|
|
20 | 20 | They enable the construction of pipelines with advanced data flow |
21 | 21 | requirements. |
22 | 22 |
|
23 | | -Key Classes |
24 | | ------------ |
25 | | -- `Feature`: |
| 23 | +- **Feature Properties** |
| 24 | +
|
| 25 | + Features in DeepTrack2 can have dynamically sampled properties, enabling |
| 26 | + parameterization of transformations. These properties are defined at |
| 27 | + initialization and can be updated during pipeline execution. |
| 28 | +
|
| 29 | +- **Pipeline Composition** |
| 30 | +
|
| 31 | + Features can be composed into flexible pipelines using intuitive operators |
| 32 | + (`>>`, `&`, etc.), making it easy to define complex data processing |
| 33 | + workflows. |
| 34 | +
|
| 35 | +- **Lazy Evaluation** |
| 36 | +
|
| 37 | + DeepTrack2 supports lazy evaluation of features, ensuring that data is |
| 38 | + processed only when needed, which improves performance and scalability. |
| 39 | +
|
| 40 | +Module Structure |
| 41 | +---------------- |
| 42 | +Key Classes: |
| 43 | +
|
| 44 | +- `Feature`: |
| 45 | +
|
26 | 46 | Base class for all features in DeepTrack2. Represents a modular data |
27 | 47 | transformation with properties and methods for customization. |
28 | 48 |
|
29 | | -- `StructuralFeature`: |
| 49 | +- `StructuralFeature`: |
| 50 | +
|
30 | 51 | A specialized feature for organizing and managing hierarchical or logical |
31 | 52 | structures in the pipeline. |
32 | 53 |
|
33 | | -- `Value`: |
| 54 | +- `Value`: |
| 55 | +
|
34 | 56 | Stores a constant value as a feature. Useful for passing parameters through |
35 | 57 | the pipeline. |
36 | 58 |
|
37 | | -- `Chain`: |
| 59 | +- `Chain`: |
| 60 | +
|
38 | 61 | Sequentially applies multiple features to the input data (>>). |
39 | 62 |
|
40 | | -- `DummyFeature`: |
| 63 | +- `DummyFeature`: |
| 64 | +
|
41 | 65 | A no-op feature that passes the input data unchanged. |
42 | 66 |
|
43 | 67 | - `ArithmeticOperationFeature`: |
| 68 | +
|
44 | 69 | A parent class for features performing arithmetic operations like addition, |
45 | 70 | subtraction, multiplication, and division. |
46 | 71 |
|
47 | | -Module Highlights |
48 | | ------------------ |
49 | | -- **Feature Properties** |
| 72 | +Functions: |
50 | 73 |
|
51 | | - Features in DeepTrack2 can have dynamically sampled properties, enabling |
52 | | - parameterization of transformations. These properties are defined at |
53 | | - initialization and can be updated during pipeline execution. |
| 74 | +- `propagate_data_to_dependencies`: |
54 | 75 |
|
55 | | -- **Pipeline Composition** |
| 76 | + def propagate_data_to_dependencies( |
| 77 | + feature: Feature, |
| 78 | + **kwargs: Any |
| 79 | + ) -> None |
56 | 80 |
|
57 | | - Features can be composed into flexible pipelines using intuitive operators |
58 | | - (`>>`, `&`, etc.), making it easy to define complex data processing |
59 | | - workflows. |
| 81 | + Propagates data to all dependencies of a feature, updating their properties |
| 82 | + with the provided values. |
60 | 83 |
|
61 | | -- **Lazy Evaluation** |
| 84 | +- `merge_features`: |
62 | 85 |
|
63 | | - DeepTrack2 supports lazy evaluation of features, ensuring that data is |
64 | | - processed only when needed, which improves performance and scalability. |
| 86 | + def merge_features( |
| 87 | + features: list[Feature], |
| 88 | + merge_strategy: int = MERGE_STRATEGY_OVERRIDE, |
| 89 | + ) -> Feature |
| 90 | +
|
| 91 | + Merges multiple features into a single feature using the specified merge |
| 92 | + strategy. |
65 | 93 |
|
66 | | -Example |
67 | | -------- |
| 94 | +Examples |
| 95 | +-------- |
68 | 96 | Define a simple pipeline with features: |
69 | 97 | >>> import deeptrack as dt |
70 | 98 | >>> import numpy as np |
|
115 | 143 | from deeptrack.sources import SourceItem |
116 | 144 | from deeptrack.types import ArrayLike, PropertyLike |
117 | 145 |
|
118 | | - |
119 | | -#TODO: for all features check whether image should be Image, np.ndarray, or both. |
120 | | - |
121 | 146 | MERGE_STRATEGY_OVERRIDE: int = 0 |
122 | 147 | MERGE_STRATEGY_APPEND: int = 1 |
123 | 148 |
|
@@ -4630,7 +4655,7 @@ class SampleToMasks(Feature): |
4630 | 4655 | ValueError |
4631 | 4656 | If `merge_method` is invalid. |
4632 | 4657 |
|
4633 | | - Example |
| 4658 | + Examples |
4634 | 4659 | ------- |
4635 | 4660 | >>> import deeptrack as dt |
4636 | 4661 | >>> import matplotlib.pyplot as plt |
|
0 commit comments