Feature Extraction
Hierarchical feature extraction for multi-level analysis.
Hierarchical Features
Extract features at multiple levels: voxels, nodes, branches, organelles, and images.
hierarchical
Hierarchy
Hierarchy(im_info, skip_nodes=True, viewer=None, use_gpu=True, low_memory=False, enable_motility=True, enable_adjacency=True, device=None, node_chunk_size=None, max_node_mask_elems=int(50000000.0))
Main orchestration class for hierarchical feature extraction.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
im_info
|
ImInfo
|
Image metadata object. |
required |
skip_nodes
|
bool
|
If True, node-level features are skipped. |
True
|
viewer
|
optional
|
Viewer object with |
None
|
use_gpu
|
bool
|
If True and CuPy is available, some computations will attempt to use GPU. Ignored when device is set to "cpu" or "gpu". |
True
|
low_memory
|
bool
|
If True, use low-memory (slower) aggregation strategies where possible. |
False
|
enable_motility
|
bool
|
If False, skip all motion-related features (flow interpolation, velocities, etc.). |
True
|
enable_adjacency
|
bool
|
If False, skip adjacency map construction. |
True
|
device
|
(auto, cpu, gpu)
|
Backend selection for GPU-eligible operations. "auto" uses GPU if available. |
"auto"
|
node_chunk_size
|
int
|
Target number of voxels per chunk when assigning voxels to nodes. |
None
|
max_node_mask_elems
|
int
|
Upper bound on the size of the node/voxel mask (num_nodes * chunk_size). |
int(50000000.0)
|
run
run()
Main execution method.
Voxels
Voxels(hierarchy)
Voxel-level features.
Nodes
Nodes(hierarchy)
Node-level features.
Branches
Branches(hierarchy)
Branch-level features.
Components
Components(hierarchy)
Component (organelle)-level features.
Image
Image(hierarchy)
Image-level aggregated features.
append_to_array
append_to_array(to_append)
Convert feature dict into list-of-arrays + headers.
create_feature_array
create_feature_array(level, labels=None)
Original non-streaming implementation kept for backwards compatibility. Not used inside Hierarchy anymore (which streams to CSV directly).
aggregate_stats_for_class
aggregate_stats_for_class(child_class, t, list_of_idxs, low_memory=False)
Aggregate mean/std/min/max/sum over groups of indices for a given class at time t.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
child_class
|
object with stats_to_aggregate and per-stat per-frame arrays
|
|
required |
t
|
int
|
|
required |
list_of_idxs
|
list of 1D index arrays (groups)
|
|
required |
low_memory
|
bool
|
If True, use a slower but memory-light implementation. |
False
|
distance_check
distance_check(border_mask, check_coords, spacing)
Compute distance from points in check_coords to nearest border point.