extract_graph_features
Note
This page is a reference documentation. It only explains the function signature, and not how to use it. Please refer to the Habitat Guide and Python API guide (v2.0) for usage.
- extract_graph_features(label_array: ndarray, *, options: HabitatGraphFeatureOptions | None = None, expected_labels: Sequence[int] | None = None, **kwargs: Any) Dict[str, float][source]
Extract subject-level graph features from a habitat label map.
Default
optionsusenode_method='uniform_grid'(8-voxel cubes, one node per in-cell subregion centroid) andedge_method='min_distance'withdistance_threshold=5.0. Passnode_method='component'/edge_method='adjacency'for the older connected-component contact graph.Keyword arguments that match
HabitatGraphFeatureOptionsfields may be passed directly (for exampleextract_graph_features(labels, include_extended_metrics=False)). When bothoptionsand kwargs are given, kwargs override individual fields viadataclasses.replace().- Parameters:
label_array – Already segmented habitat map. Label 0 is treated as background and excluded from graph construction. A full-CT lattice is cropped to the tumour VOI before nodes, edges, metrics, and size-normalized companions are computed.
options – Graph construction and metric options. When
None, a default instance is built (optionally fromkwargs).expected_labels – Optional canonical habitat ids to report. When given, every listed label produces its
single_h*columns and every unordered pair itspair_h*_h*columns even when the label is absent from this subject (empty graphs yield zero-valued metrics), so cohort-level tables have stable columns. WhenNone, only labels actually present inlabel_arrayare reported (the historical v0.1 behaviour).**kwargs – Optional field overrides for
HabitatGraphFeatureOptions(merged as described above).
- Returns:
Flat feature dictionary ready for table assembly.
- Return type: